Is it possible to restore data from a deleted but backed up commit file?


One of our developers have found out that they have mistakenly deleted a branch last month where we can find the data file in the backups but do not know how to open or import it.

BitBucket stores all the commits in \Atlassian\ApplicationData\BitBucket\shared\data\repositories\x\objects\y as some 38-character hex-value files - but how can you go about getting data out of them?

3 answers

1 accepted

Two possibilities:

  1. One of your cloned git repos might not have yet pruned that branch out of the true history, and so you if you know its original 40-character commit-id, might be able to get the branch back by simply typing "git checkout <commitId>" on a developer workstation.
  2. Grab the entire repo from your backup and copy it to a computer (\Atlassian\ApplicationData\BitBucket\shared\data\repositories\x).  Clone it locally, and jump to the deleted branch:

    git clone \path\to\copy\of\x
    cd x
    git checkout branch
- Regards,

Sylvie Davies
Founder and Software Engineer,

p.s.  I invite you to try my Bitbucket and JIRA add-ons.  Bit-Booster Commit Graph and More (for Bitbucket), and Git Graph for JIRA.

Yes,  that should be possible.

Restore the repository from backup to some workstation. Clone it locally, set origin back to the server repo, then push the deleted branch. 

Thank you both so far for your suggestions, we will test them next week.

Edit: Backup branch restored successfully, thank you for your help.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

247 views 0 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you