I have a total of 24 commits, and I had checkout to commit 15. How can I go back to my last commit?
Note: I have run a lot of commits. For instances,
git revert, git checkout, git reset.
I don't know my last commit name, id, or even the files. All I know that I have committed, but I am not there.
but I could not go back to my latest commits.
Thank you
Finally, with help of friends in here I come up with solution. the resean I post this. It may help other as well.
First, I used to git reflog to show all my last commit.
Second, I used git checkout commit_id
Third, git log --graph --decorate --pretty=oneline --abbrev-commit master github/master temp.
Then, git branch -f master temp.
And, git branch -d temp.
Finally, git push --force github master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With