Recovering lost Git commits

If you rollback to a previous commit you can lose the later commits if they’re not referenced by another branch. I just rolled back and lost a commit that I hadn’t pushed to the remote.

Easy fix.

git reflog

This will show you recent commits, and should include the commit that you’ve just lost. You can then merge it back in.

This was posted 2 months ago. It has 3 notes.
  1. karlvr posted this