I am trying to eliminate a scenario that appears, apparently by chance, every couple of days or so.
I switch to a branch that I did not touch, and they told me that I was โaheadโ of the remote branch, despite the fact that I did not make any commits in this branch. Then I try to find out what local changes I made, and I can not find them. Running git push to seem to solve the problem, but it makes us nervous to blindly push those who know it willy-nilly, not understanding the root problem. I have included the command below, which I think illustrates my confusion. If I get ahead of the remote, shouldn't git diff return my changes? I think I'm updated with the remote control, and this is what I'm trying to show with the inclusion of git fetch / git pull commands.
$ echo '====FETCH====' && git fetch && echo '====PULL====' && git pull && echo '====STATUS====' && git status && echo '====DIFF====' && git diff && echo '==== DIFF ORIGIN/DEV====' && git diff origin/dev ====FETCH==== ====PULL==== Already up-to-date. ====STATUS==== On branch dev Your branch is ahead of 'origin/dev' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working directory clean ====DIFF==== ====DIFF ORIGIN/DEV====
Does anyone know what is going on here?
source share