Please do following set of commands in order to merge with the master, Assuming that you are in branch testBranch and you want to merge the changes with the master,

First checkout to master branch,

git checkout master

Now pull the latest changes in master,

git pull origin master

Merge with the testBranch

git merge testBranch

Push the changes to master

git push origin master

That's it, you are done.

Answer from Actung on Stack Overflow
🌐
Medium
medium.com › @scott.sourile › git-hub-merging-your-git-branches-from-the-website-directly-5bbc31b1d816
Git Hub: Merging your Git Branches from the website directly. | by Scott Sourile | Medium
October 30, 2023 - Once the pull request is created, you’ll see a “Merge pull request” button. If there are no conflicts, you can click on it to merge the test branch into main. If there are conflicts, GitHub will notify you, and you’ll need to resolve them before proceeding.
Discussions

How to merge branch to master?

Merge the development branch into master

  1. In the GitHub Desktop client, select the development branch. Make a change to a file, and then commit the changes.

2. Switch to the master branch.

3. Go to Branch > Merge into Current Branch.

4. In the merge window, select the development branch, and then click Merge into master.

Source - https://idratherbewriting.com/learnapidoc/pubapis_github_desktop_client.html

More on reddit.com
🌐 r/github
7
1
June 15, 2018
Git: How to merge branch to master locally and on Github? - Stack Overflow
I have a project with a master branch. So I created another branch dev and later uploaded it to Github. Finished the work in the dev branch, uploaded it to Github and merged it to master locally. M... More on stackoverflow.com
🌐 stackoverflow.com
How do I safely merge a Git branch into master? - Stack Overflow
Next choose a very good commit message and push to GitHub. Make the pull request then. After the merge of the pull request, you can delete it locally: ... "which should only be one commit in the master branch", well not necessarily; you may wekk want to keep the history 2018-04-12T10:46:28... More on stackoverflow.com
🌐 stackoverflow.com
how to merge branches on GitHub website, besides pull request - Stack Overflow
This question is specific to GitHub website. I know that a pull request merges changes from a feature branch to the main/master branch, but how can I do the reverse and merge any updates from main/... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Git
git-scm.com › book › en › v2 › Git-Branching-Basic-Branching-and-Merging
Git - Basic Branching and Merging
All you have to do is check out the branch you wish to merge into and then run the git merge command: $ git checkout master Switched to branch 'master' $ git merge iss53 Merge made by the 'recursive' strategy.
🌐
W3Schools
w3schools.com › git › git_branch_merge.asp
Git Branch Merge
No-fast-forward merge: Use git merge --no-ff branch to always create a merge commit, preserving branch history. As master and emergency-fix are essentially the same now, we can delete emergency-fix, as it is no longer needed:
🌐
YouTube
youtube.com › cameron mckenzie
How to Merge GitHub Branches to Master - YouTube
Have you pushed all your Git commits to GitHub, and now you must merge GitHub branches into Master? It's not quite a simple as a Git merge on the command lin...
Published   October 6, 2021
Views   99K
🌐
Stack Overflow
stackoverflow.com › questions › 61387108 › git-how-to-merge-branch-to-master-locally-and-on-github
Git: How to merge branch to master locally and on Github? - Stack Overflow
You need to merge in one repository and then use git push or git pull to sync the local and remote repositories. At the moment you have two merges between master and development that occurred at two different times.
Find elsewhere
🌐
DedicatedCore
dedicatedcore.com › home › how to safely merge a git branch into master
How to Safely Merge a Git Branch into Master - DedicatedCore Blog
October 31, 2024 - The master branch is selected by the command. Utilize the git merge command to combine a different branch into a master after switching.
Top answer
1 of 16
3750

How I would do this

git checkout master
git pull origin master
git merge test
git push origin master

If I have a local branch from a remote one, I don't feel comfortable with merging other branches than this one with the remote. Also I would not push my changes, until I'm happy with what I want to push and also I wouldn't push things at all, that are only for me and my local repository. In your description it seems, that test is only for you? So no reason to publish it.

git always tries to respect yours and others changes, and so will --rebase. I don't think I can explain it appropriately, so have a look at the Git book - Rebasing or git-ready: Intro into rebasing for a little description. It's a quite cool feature

2 of 16
558

This is a very practical question, but all the answers above are not practical.

Like

git checkout master
git pull origin master
git merge test
git push origin master

This approach has two issues:

  1. It's unsafe, because we don't know if there are any conflicts between test branch and master branch.

  2. It would "squeeze" all test commits into one merge commit on master; that is to say on master branch, we can't see the all change logs of test branch.

So, when we suspect there would some conflicts, we can have following git operations:

git checkout test
git pull 
git checkout master
git pull
git merge --no-ff --no-commit test

Test merge before commit, avoid a fast-forward commit by --no-ff,

If conflict is encountered, we can run git status to check details about the conflicts and try to solve

git status

Once we solve the conflicts, or if there is no conflict, we commit and push them

git commit -m 'merge test branch'
git push

But this way will lose the changes history logged in test branch, and it would make master branch to be hard for other developers to understand the history of the project.

So the best method is we have to use rebase instead of merge (suppose, when in this time, we have solved the branch conflicts).

Following is one simple sample, for advanced operations, please refer to http://git-scm.com/book/en/v2/Git-Branching-Rebasing

git checkout master
git pull
git checkout test
git pull
git rebase -i master
git checkout master
git merge test

Yep, when you have uppers done, all the Test branch's commits will be moved onto the head of Master branch. The major benefit of rebasing is that you get a linear and much cleaner project history.

The only thing you need to avoid is: never use rebase on public branch, like master branch.

Never do operations like the following:

git checkout master
git rebase -i test

Details for https://www.atlassian.com/git/tutorials/merging-vs-rebasing/the-golden-rule-of-rebasing

appendix:

  • if you are not sure about rebasing operations, please refer to: https://git-scm.com/book/en/v2/Git-Branching-Rebasing
🌐
Stack Overflow
stackoverflow.com › questions › 72873768 › how-to-merge-branches-on-github-website-besides-pull-request
how to merge branches on GitHub website, besides pull request - Stack Overflow
If you believe it’s different, ... on this post. Hate to say it, but that's still a PR. Just set which two branches you want to go into, and from, in the PR....
🌐
Stack Abuse
stackabuse.com › git-merge-branch-into-master
Git: Merge Branch into Master
April 20, 2023 - $ git commit –m "Some commit message" $ git checkout master Switched to branch 'master' $ git merge new-branch · You always checkout the branch you're merging into, and merge a branch that already has changes. If you're newer to Git, though, it's worth taking a few minutes to understand ...
🌐
0
axolo.co › blog › p › github-branching-and-merging-step-by-step-guide
GitHub Branching and Merging: A Step-By-Step Guide | Axolo Blog
November 27, 2024 - When you merge branches in GitHub, such as performing a GitHub merge branch to master, the changes from the source branch are applied to the target branch. GitHub tracks these updates through a "merge commit," which acts as a record of when the branches were combined.
🌐
GitHub
docs.github.com › en › repositories › configuring-branches-and-merges-in-your-repository
Configuring branches and merges in your repository - GitHub Docs
You can manage branches in your repository, configure the way branches are merged in your repository, and protect important branches by defining the mergeability of pull requests.
🌐
PhoenixNAP
phoenixnap.com › home › kb › devops and development › how to merge a git branch into master
How to Merge a Git Branch into Master | phoenixNAP KB
December 17, 2025 - The command switches to the master branch. After switching, use the git merge command to merge another branch into master.
🌐
Eriqande
eriqande.github.io › rep-res-web › lectures › git-branch-and-merge.html
Branch and Merge · Reproducible Research.
Sometimes it is more complicated, if both branches have changed from their common parent. But, git takes care of most of the details · To merge testing into master is simple because master is a direct ancestor of testing.
🌐
Design Gurus
designgurus.io › answers › detail › how-do-i-safely-merge-a-git-branch-into-master
How do I safely merge a Git branch into master?
November 2, 2024 - Ensure that all team members update their local repositories to reflect the latest changes. ... Optionally, tag significant commits on master for future reference. git tag -a v1.0 -m "Release version 1.0" git push origin v1.0 · Keep an eye on the master branch for any issues that might arise post-merge, addressing them promptly. Pull Requests (PRs) are a collaborative feature provided by platforms like GitHub, GitLab, and Bitbucket.
🌐
Nira
nira.com › home › how to merge branches in github
How To Merge Branches In GitHub - Nira
June 27, 2022 - After adding your code to the develop branch, you’ll be ready to create a pull request to merge the develop branch and the main branch. On the GitHub page for your repository, click on the Branches menu. You should see a list of all available ...
🌐
GitHub
docs.github.com › en › desktop › working-with-your-remote-repository-on-github-or-github-enterprise › syncing-your-branch-in-github-desktop
Syncing your branch in GitHub Desktop - GitHub Docs
To add changes from one branch to another branch, you can merge the branches. To apply changes to your branch from another branch in the same repository, you can merge the other branch into your branch on GitHub Desktop. To request that changes from your branch are merged into another branch, in the same repository or in another repository in the network, you can create a pull request on GitHub Desktop.
🌐
Namehero
namehero.com › blog › how-to-merge-a-git-branch-to-master
How to Merge a Git Branch to Master
October 6, 2025 - Now that we’ve finished working on our new feature in the “new-feature” branch, it’s time to merge the changes with the main branch. To do this, we first have to switch to the main branch and merge the new branch from there.
🌐
Simple Dev
simpledev.io › home › merge branches – github desktop
Merge branches - GitHub Desktop - Simple Dev
May 16, 2022 - Select the branch you want to merge into master in the dialog box that appears, and then click the button that says Merge branch-name into master. Switching between branches – GitHub Desktop Help