I can go back and forward in my history using git checkout heads
git revert heads
git reset heads
And when I do git push origin main
I get Everything up-to-date
and no change on remote server.
how to solve it?
BTW Im pushing to this repository BKazimy and I want to go back to my second commit in history.
I tried:
git push origin main
git push -u origin main
git push -f origin main
git push -u -f origin main
All had same response Everything up-to-date
and no change on remote.
Do not check anything else out. You need to be on your branch and then hard reset the branch pointer to the commit you want to go back to. You would say
git switch main
git reset --hard 3e295a5
git push -f origin main
Note that the more recent commits (the children of 3e295a5
) will eventually die if you don't act to preserve them.