Reputation: 28252
I have an old version of a repo I want to take a look at, because I think I screwed things up in the time since that commit. Haw can I just look at that commit, without screwing up my entire repository and going to the scary detached head mode and everything?
Upvotes: 0
Views: 94
Reputation: 1065
git archive --prefix=old/ $the_old_commit_id | tar xf -
... if you want to extract all files at the old commit. There are several ways to show files or diff at the old commit as others answered.
Additionally it's worth to investigate git blame
, git bisect
and git log -S
if you don't know which commits introduced a problem.
Upvotes: 0
Reputation: 7421
You can use git show REVISION:file
to view a specific file as of the specified revision.
Upvotes: 2
Reputation: 9820
You need to check out the commit by commit id, look in your git log for the right id. If you don't want to mess your current repo then clone it so you are working in a different place.
git checkout commitID
Upvotes: 1
Reputation: 6182
You can use "git show SHA" to show the diff for that commit. You can use "git diff SHA" to see a diff between your current workspace contents and that SHA. You can also copy your .git someplace else and check out another copy in "scary detached head mode". A final option is to use "git stash" to store your work in progress changes, then go into detached head mode.
Upvotes: 1