I clone my git project to my U-disk. I change a file a.txt of the project in my U-disk.
Then, in my project root directory of the U-disk, I run git push. It notes success.
But in my origin project, it stays unchanged.
However, in the origin project root directory, when i run git status, it appears a change of a.txt. When i run git --hard HEAD, it appears my change in U-disk.
What’s the matter? How to solve it?
Is your origin project a bare repository? If not, a push to a branch that is currently checked out might lead to this kind of behavior.
Solution: Do not push to a branch that is currently checked out in the origin repository. If possible, use a bare repository as origin.