I have two branches in my local git repository, master and Logging. Both branches have remotes on BitBucket. master is the main branch of the project I’m currently working on. When other developers have finished features, they merge their branches into master. Logging is my current feature branch and was created from master.
To get the latest updates and reduce my merge pain, every so often I do a:
git pull origin master
while the Logging branch is checked out. My understanding of this command is it fetches from the remote origin of the master branch and merges any changes into the local master.
I then do:
git merge master
What I’m intending to do here is merge the changes I’ve just pulled into the Logging branch. However git always responds with:
Already up-to-date.
Indeed looking at git log and gitk seems to indicate that my local Logging branch does already contain the just pulled contents of master. I wasn’t expecting that doing a “git pull origin master” would affect my Logging branch at all. What am I not understanding here?
Git pull includes a merge:
is equivalent to
I.e. it merges the specified origin’s branch into currently checked out branch.
The
git fetch originalone does not look at currently checked out branch at all. What it does is get the revisions and store the remote heads underrefs/remotes/originnamespace. That’s where thegit merge origin/masterpulls it from (if name is not qualified withrefs/something, git looks inrefs/heads,refs/tagsandrefs/remotes).