If I run git branch -d XYZ
, is there a way to recover the branch? Is there a way to go back as if I didn\'t run the delete branch command?
Adding to tfe answer: there is also the git-resurrect.sh script in the contrib/
area of the Git sources (in git.git repository), which might help you.
git-resurrect
attempts to find traces of a branch tip called, and tries to resurrect it. Currently, the reflog is searched for checkout messages, and with
-r
also merge messages. With-m
and-t
, the history of all refs is scanned forMerge
/into other Merge
(respectively) commit subjects, which is rather slow but allows you to resurrect other people's topic branches.into