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?

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.