Is there any way to find out what an entire file looked like in a particular commit after applying all changes to it? I know there is a difference between 2 files(what was added and removed) and that's what shown in git. But that's not what I'm looking for.
Asked
Active
Viewed 414 times
5
-
4Are you looking for `git show revision-id:path/to/file` ? – DCoder Dec 25 '13 at 14:54
-
@DCoder revision-id - is a part of the command or a filler? – Incerteza Dec 25 '13 at 14:58
-
@Alex: revision-id is a filler. path/to/file is also a filler. – pts Dec 25 '13 at 14:59
-
@DCoder `fatal: reference is not a tree:` – Incerteza Dec 25 '13 at 15:00
1 Answers
10
If you know the commit id you can checkout the specific file like below:
git checkout <commitid> yourfile
EDIT
If you don't want to modify your local version use:
git show <commitid>:filename

Saravana
- 37,852
- 18
- 100
- 108
-
-
-
Yes it will. If you want to just see what it looked like, use `git show commitid:filename` – Saravana Dec 25 '13 at 15:06
-
git show commitid:filename - error - fatal: reference is not a tree - – Incerteza Dec 25 '13 at 15:41
-
You've got to use git hash instead of `commitid` and full path to the file from the top of your git repository as the `filename` – ArtemB Dec 27 '13 at 07:21