I want to recover a branch that was deleted from our remote shared repository on Bitbucket.
I know that reflog
is the way to go with local repositories.
How would I got about achieving this on the remote one?
In the case of manual search using reflog tool, we must be aware that even the Bitbucket in their official documentation recommends a full backup of our project before starting this process. This means that using the GitProtect.io solution will allow us to reverse the lost branch with one click.
A deleted Git branch can be restored at any time, regardless of when it was deleted. Open your repo on the web and select the Branches view. Search for the exact branch name using the Search all branches box in the upper right. Click the link to Search for exact match in deleted branches.
Four years later...
I came across this answer because I deleted a branch through the bitbucket.org UI that a team member wanted restored.
I discovered that git branch --remote
shows all the branches on origin, even the ones that are deleted through the UI.
I checked out the origin branch locally with git checkout origin/<branch_name> -b <branch_name>
, then did git push -u origin <branch_name>
and it showed up in the UI again.
reflog
is still the answer, except you don't have access to the reflog
on the remote (Bitbucket ) side.
That means you need to write to Bitbucket support in order for them to restore what you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With