This Stack Overflow question largely explains what happens when you do a git pull
from another remote branch.
# from new_feature
git pull origin master
The above is equivalent to this:
# from new_feature
git fetch origin master && git merge master
But, the kicker here is that in your case Git actually won't execute the above, because the merge is not a fast forward merge. This is because your branches currently look like this:
master: ... A -- C
\
new_feature: B
That is, merging the C
commit on top of B
is more than just a simple replay, because there could be merge conflicts.
What you should instead be doing in this situation, and arguably what you always should do in this situation, is to just merge master
into your feature branch:
# from new_feature
git fetch origin master
git merge origin/master
Note that there may be merge conflicts, which you would then have to fix, then make a commit to complete the merge.
After the commit, your branch should look like this:
master: ... A -- C
\ \
new_feature: B -- D
Commit D
is a merge commit, and actually has both B
and C
as parents.