How Do I 'git fetch' and 'git merge' from a Remote Tracking Branch (like 'git pull')
Posted
by kaybenleroll
on Stack Overflow
See other posts from Stack Overflow
or by kaybenleroll
Published on 2010-04-08T18:45:02Z
Indexed on
2010/04/08
19:13 UTC
Read the original article
Hit count: 897
I have set up some remote tracking branches in git, but I never seem to be able to merge them into the local branch once I have updated them with 'git fetch'.
For example, suppose I have remote branch called 'an-other-branch'. I set that up locally as a tracking branch using
git branch --track an-other-branch origin/an-other-branch
So far, so good. But if that branch gets updated (usually by me moving machine and commiting from that machine), and I want to update it on the original machine, I'm running into trouble with fetch/merge:
git fetch origin an-other-branch
git merge origin/an-other-branch
Whenever I do this, I get an 'Already up-to-date' message and nothing merges.
However, a
git pull origin an-other-branch
always updates it like you would expect.
Also, running git diff
git diff origin/an-other-branch
shows that there are differences, so I think I have my syntax wrong.
What am I doing wrong?
© Stack Overflow or respective owner