Skip to content

Revive a Deleted Branch

Benjamin Arnold edited this page Jun 4, 2018 · 1 revision

If you accidentally deleted a branch locally and remotely, the fix is relatively easy:

1. Open Git Bash Shell in repo
2. Type "git fsck --lost-found"
3. Type "ls .git/lost-found/commit/ | xargs git log > commitlog.txt"
4. search commitlog.txt for your commit
5. Type "git checkout -b <NewBranchName> <first 7 characters of commit ID>", where you supply both arguments inside the braces