0

I've tried to change my last commit message so I did git commit --amend after that I didn't change anything, close my editor and my last commit is gone, how can I retrieve?

EDIT: You can solve that problem using the information of comments about. On my problem git reflog and git checkout HEAD{0} solved.

João Victor
  • 639
  • 6
  • 20
  • 3
    Possible duplicate of [How can I recover a lost commit in Git?](https://stackoverflow.com/questions/10099258/how-can-i-recover-a-lost-commit-in-git) – Mako212 Sep 27 '18 at 18:46
  • 2
    check `git reflog`. – eftshift0 Sep 27 '18 at 19:20
  • How do you check the commit is gone? – tymtam Sep 28 '18 at 03:47
  • Sorry for late response guys, @Mako212 was correct I don't realize what is happen and couldn't figure out how to solve my problem with the solution of previous post, so I use `git reflog` and then `git checkout HEAD{0}` – João Victor Oct 02 '18 at 01:53

1 Answers1

0

Maybe it works for you to use

git reset --hard id_commit

or

git revert id_commit
Wilmar PR
  • 21
  • 3