I deleted a git branch from my server with the command
git push origin :feature-my-branch
I did not have the branch checked out/saved locally. Is there some way I could recover this branch or is it gone forever?
When I do
git branch --all
I cannot see feature-my-branch. When I do
git reflog --no-abbrev
I can not find the tip of feature-my-branch.
I managed to recover my branch by doing
git fsck --dangling
where I found a dangling commit which was the head of feature-my-branch. Then I recovered feature-my-branch and pushed it to the server:
git branch feature-my-branch <commit-id>
git push origin feature-my-branch