0

I have a remote branch on a git server where another developer git push forced a his master branch onto. I have a local master branch right now that I am trying to merge my master branch with the remote master branch. How do I do this?

user1660601
  • 263
  • 1
  • 4
  • 9

1 Answers1

1

First off, backup your current master branch

git checkout master && git branch master_bkp

Next, fetch the updated changes

git fetch 

Now rebase branch your local master branch onto the fetched origin/master branch

git rebase origin/master

If you had comits on your master branch earlier, that you would like to bring into this freshly pulled master branch, you can cherry-pick them

Community
  • 1
  • 1
Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186
  • The wording in "Now rebase the fetched `origin/master` branch onto your local master branch" is backwards: you're rebasing your local work onto the fetched branch. – amalloy Sep 08 '14 at 21:41