Restore files deleted during an old commit

Hi,

I have the id of a commit in which a bunch of files were erroneously deleted.  There have been hundreds of commits since.  What I'd like to do is restore these deleted files.

I've pulled the git repo down to SourceTree and clicked 'Jump To' then selected 'Commit...'.  In there I pasted the commit id and searched.  I now have the commit highlighted in the main window.

So from here, how do I (a) locate the files I need to revert (I know which ones I'm looking for but can't find out how to see them in this commit) and (b) how do I then revert these files so that they're back in the most up to date commit?

Do I need to right-click the commit containing the deleted the files and check it out?  If so, that tells me it's going to create a 'deatached head' - is this okay?

Thanks for any pointers folks.  As a git noob I really appreciate any assistance, no matter how simple this may seem to some.

1 answer

This widget could not be displayed.

Please read my answer to a very similar question here.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

721 views 1 3
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