Git reflog: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 11: Line 11:
  git reflog
  git reflog


Look for the deleted commit
Look for the deleted commit.


  git checkout <''commit-id''>
  git checkout <''commit-id''>


Will checkout the commit in "detached HEAD" state.
Will checkout the commit in "detached HEAD" state.

Revision as of 20:23, 24 March 2020

Internal

Overview

Recovering a Deleted Commit

This procedure applies even if the commit was deleted as part of a rebase. Anecdotal evidence seems to suggest that it applies to commits newer than 30 days.

git reflog

Look for the deleted commit.

git checkout <commit-id>

Will checkout the commit in "detached HEAD" state.