Re: Stepping through a single file's history
- From
John Tapsell <johnflux@gmail.com>
- Date
- Jan 29, 2010, 03:47 UTC
- Message-ID
- <43d8ce651001281947m2505dbcco992ad98ddbfeaeae@mail.gmail.com>
- In-Reply-To
- <43d8ce651001281758x79965b5fn8760b69d4fe82a36@mail.gmail.com>
2010/1/29 John Tapsell <johnflux@gmail.com>:
Show 10 quoted lines
> 2010/1/29 Ron Garret <ron@flownet.com>: >> Hello, >> >> Is there an easy way to step through the history of a single file? To be more specific: > ... >> (The use case here is remembering that back in the day there was some useful code in this file that I want to retrieve, but not remembering exactly when it was deleted. So I want to step back through this file's history and do diffs against HEAD.) > > How about simply doing: > > git log -p filename
You can also do like:
git show HEAD~3:path/filename
where path is the path from the top of the git repository. This would show the file as it was 3 revisions ago.
You can also do like:
git checkout HEAD~3 filename
to checkout the first as it was 3 revisions ago.