In this post, we will see how to resolve Git pull with unstashed changes succeeds
Question:
I have the same repo cloned on two machines, with both machines having exactly the same git version (2.34.1).On machine 1:
pull
succeeds, and the second pull
fails with:git status
that Makefile is modified, yet rather than getting an error I get Already up to date.
- What might be the cause of the difference in behavior?
- How to fix it (make it fail when files are modified)?
Best Answer:
Check first if on the second machinegit config pull.rebase
is set to true.If not, a pull would use
git merge
, which can work if Makefile
is not part of the modification being pulled (and merged).Already up to date
should mean there is nothing to pull from the second machine: check the git log --decorate --oneline --graph
on both machines to confirm the local repository reference the same history or not.If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com