Skip to content

.tip

· one of the small things

reflog is the undo button for the rebase you regret

Git records every position HEAD has been in over the last 90 days, even after a reset, a rebase or a deleted branch.

git reflog
# a1b2c3d HEAD@{3}: rebase (finish): returning to refs/heads/feat
# f4e5d6c HEAD@{4}: commit: the state before the rebase
git reset --hard HEAD@{4}

Nothing you committed is lost until the reflog expires. Look here first, and save the panic for later.

git