Reputation: 64443
I have made several commits to a file. How could a get back to a specific version of time of that file?
Thanks.
Upvotes: 1
Views: 130
Reputation: 234654
Use git log
to see the commits you made and choose the one you want to get back. Note its SHA1 hash.
Then use git checkout
to get to that version of the file:
git checkout f93b3e path/to/file
In fact, any tree-ish will work here. For instance, if you wanted the file as it was last month you could do:
git checkout master@{1 month ago} path/to/file
Upvotes: 4
Reputation: 14101
If you want a visual tool use gitk
from the branch in question.
As you select various commits you can inspect content to find the right one.
You can right click on the commit to check out the whole commit out as a 'detached head', that is, it will be detached from the branch's tip.
Upvotes: 0