How to merge branch to master?

k.vincent picture k.vincent · Nov 2, 2017 · Viewed 43k times · Source

I do have a local branch with some changes, and I want to merge it to remote master. When I run: git merge master I get:

Already up-to-date

but I still can see that the master doesn't contain the new changes.

I checked the following issue Git merge reports “Already up-to-date” though there is a difference Ask, but it seems in one hand to be outdated, and on the other hand, none of the hints there were helpful.

Any idea or hint?

Answer

divsingh picture divsingh · Nov 2, 2017

If you want to merge your branch to master on remote, follow the below steps:

  1. push your branch say 'br-1' to remote using git push origin br-1.
  2. switch to master branch on your local repository using git checkout master.
  3. update local master with remote master using git pull origin master.
  4. merge br-1 into local master using git merge br-1. This may give you conflicts which need to be resolved and changes committed before moving further.
  5. Once merge of br-1 to master on local is committed, push local master to remote master using git push origin master.