Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What might cause `git pull` to fail seeing remote changes?

In what circumstances might the git pull origin master command result in a different working copy state than git checkout master -> git pull -> git checkout feat-a -> git merge master ?

The long story.

I have a feature branch, lets call it feat-a. I am the only developer working on this branch. The branch was created from master branch. Both branches have remote origins, origin/feat-a and origin/master. Nothing special, your typical git repository arrangement.

Today I wanted to update my feature branch from remote master. From earlier communication with other developers, I knew there will be conflicting changes when I merge remote master into my feature branch.

I'm using SourceTree. So, with feat-a branch checked out, I opened context menu on origin/master branch and picked Pull origin/master into current branch. I was shocked to see Git reporting that my branch is already up-to-date. I knew it's not right, there must be changes on remote master branch. I repeated the command a few times. Always got the same up-to-date message.

To be 100% sure, I did it "the long way". I checked out master branch, clicked Pull button. The branch got updated with the latest commits. Then I checked out feat-a branch and then pulled context menu on master branch and picked Merge master into current branch. Voila! Here was the merge conflict I expected to get!

This got me puzzled. I had assumed that performing pull from origin/master into my current branch is the same as checking out master, pulling, checking out the other branch and then merging master into the current branch (with exception that pulling from remote master into another branch does not update my local master, but that shouldn't affect this issue).

Essentially, for some reason pull command from origin/master into feat-a was trying to convince me that there are no changes on origin/master, and only the long way with switching branches and manual merging worked as expected.

I'm not sure if SourceTree is doing something special which might affect this issue.

like image 673
JustAMartin Avatar asked Nov 08 '22 19:11

JustAMartin


1 Answers

You say you use Sourcetree, so I guess you didn't actually type git pull origin master on the command line. My guess is it is either something confusing in the GUI message, or a bug in Sourcetree.

I'd rather ask to the Sourcetree developpers.

like image 159
LeGEC Avatar answered Nov 15 '22 06:11

LeGEC