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?
Make sure to perform all of this locally, and confirm your repo is in the state you desire before pushing to Bitbucket Cloud. It may also be a good idea to clone your current repo, and test these solutions out first.
Deleted branch (was )
2.To restore the branch, use:
git checkout -b
If you don't know the 'sha' off the top of your head, you can:
git reflog
git checkout -b
If your commits are not in your reflog:
git fsck --full --no-reflogs --unreachable --lost-found | grep commit | cut -d\ -f3 | xargs -n 1 git log -n 1 --pretty=oneline > .git/lost-found.txt
2.You can then display each commit using one of these:
git log -p
git cat-file -p