I have the same repo cloned on two machines, with both machines having exactly the same git version (2.34.1).
On machine 1:
git pull
echo '# comment' >> Makefile
git pull
As expected, in the above commands, the first pull
succeeds, and the second pull
fails with:
error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.'
On machine 2 (an aws/ec2 instance, and using a readonly SSH key, in case these are relevant), I repeat exactly the same set of commands (and confirm 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)?