0
  1. I fork a master repo on Bitbucket.com?
  2. I create a new branch called "branch-A" on my copied repo from #1.
  3. I switch to "branch-A"
  4. I point "upstream" to the master repo. I did a "git fetch upstream"
  5. I ran "git merge upstream/master"

It is strange to me at at step 5, git merge DID NOT apply the merge to the master branch on my local repo, instead, it applied the merge to "branch-A". Is this the proper behavior of git? Or I'm missing something here?

bahrep
  • 29,961
  • 12
  • 103
  • 150
user1187968
  • 7,154
  • 16
  • 81
  • 152

1 Answers1

0

It is strange to me at at step 5, git merge DID NOT apply the merge to the master branch on my local repo, instead, it applied the merge to "branch-A".

Yes, it is the expected behavior since, in step 3, you switched to branchA.
git merge merges in the current branch.

To apply the merge to master, swtich back to master before step 5

git checkout master 
git merge upstream/master

An alternative approach would be to:

That way, a simple git pull (after git checkout master) would always pull from upstream, but a git push would push to your fork origin.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250