Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It was 'git reset --HARD <commit-id>', like a cherry pick, before pushing.


Even with --hard, the commit isn't lost. Commits are not immediately removed from the repository, only when git runs the garbage collection. Try it: create a test commit, make a note of its hash, reset to HEAD~1 and then reset again to that hash.

When you do this by mistake and you don't know the hash you can find it using git reflog, which logs everything that happens in the repository.

More detailed: http://gitready.com/intermediate/2009/02/09/reflog-your-safe...


If it was "before pushing" that means the commit has been made, and thus isn't lost (but accessible via the reflog.)


  git reflog
Might be your saviour here next time.


I'll update the post. This worked for me. Thanks a lot!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: