shan
shan

Reputation: 3145

Need to grab a bit of code from a previous commit -- Sourcetree

I must have accidentally deleted part of my javascript but it's gone. I have a bunch of commits, a few of which have the code I need, but I didn't push until way after that code was deleted and I wrote a bunch of new code.

What is the best way to grab code from a previous commit on Sourcetree? I've been told I can't do it from Git since I didn't push until way after I realized it was gone.

Thanks for any help! I'm sort of a Git noob.

Upvotes: 2

Views: 239

Answers (2)

cforbish
cforbish

Reputation: 8809

Normally from the command line I issue git checkout ${good_revision} ${local_file}. I cannot find a way to do this in the SourceTree UI.

Upvotes: 0

VonC
VonC

Reputation: 1323115

As in this issue, you could simply diff your file with an old revision of the same file, in order to pick the missing part in your current version of that file.

Then add, commit and push.

http://i.imgur.com/roDYlQ3.png

Upvotes: 3

Related Questions