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:
pullsucceeds, and the second
git statusthat 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 machine
git config pull.rebaseis set to true.
If not, a pull would use
git merge, which can work if
Makefileis not part of the modification being pulled (and merged).
Already up to dateshould mean there is nothing to pull from the second machine: check the
git log --decorate --oneline --graphon 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!