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 Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

634 views 0 4
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot