Reputation: 675
I want to view a previous rev of a git repository. I am looking for the equivalent of tortoisesvn export of a particular revision. How do I do it?
Upvotes: 0
Views: 66
Reputation: 675
I tried 'git show hash -- file'. It gave a diff output.
I tried 'git checkout -b hash'. It created a new branch.
What worked for me was 'git checkout hash'.
Upvotes: 0
Reputation: 1491
Search revision by:
git log
remember the hash
of the commit and check out the commit by
git checkout -b <hash>
Upvotes: 0
Reputation: 6175
You'll first want to list the contents of the repository using git log
, and then git show <hash>
to print that revision on the screen. If you want to limit the output to a single file, you can add -- <file / path>
to the end of each command.
Upvotes: 1
Reputation: 75649
If you want to view a particular file you can use git show <hash_or_branch_name_or_tag_name> filename
to see it.
Otherwise you should do a git checkout
of that commit hash to see it.
Upvotes: 1