How to restore deleted file from Bitbucket.

I am using Sourcetree. One file got deleted from the local folder. I need to restore the file in Bitbucket to my local folder. How do I do it using SourceTree?


5 answers

1 accepted

Hi Kiran,

In SourceTree just go to the last log line that had that file in it, right click on the file in the file list for the log entry and hit "Reset to Commit..."

Hope that helps

Depends on your situation. You don't say if you have pushed the change or not. Let's say you haven't. Then, you can:

  1. Open Bitbucket's Source tab for your project.
  2. Click on the file you accidentally deleted locally.
    The system displays a view of the file's source code.
  3. Click on the Raw button.
  4. Copy the text.
  5. Open an editor on your local system.
  6. Paste the contents into the a file.
  7. Save the file into your repo.

What you do from there kinda depends on your DVCS. If you need further instructions, let us know whether you are using Mercurial or Git.


Sourcetree is not my forte. I've added that label to your question.


Thanks for the info. I am using SourceTree and Git. Any way to do this from SourceTree. I was using Tortoise with SVN. In tortoise we can take the log and replace a file from the SVN. Is there anything like that in SourceTree?

Thank you Kieran, this was what I looking. You rocks.

Thanks Mary for the support.


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Thursday 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 ROLLBAR_ACCESS_TOKEN...

159 views 0 11
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