tags:

views:

34

answers:

2

using git, I want to list all the different revisions of a given file.

Then, I want to choose a particular version and compare it when another.

How can I do this?

+4  A: 

To show a history of changes to a particular file, you can use git log:

git log -p -- path/to/file

The -p tells it to show the diff between each revision and its parent. To get a cumulative diff between two revisions, take the ID of the two revisions, and pass them to git diff:

git diff abc123 def456 -- path/to/file.

Where abc123 and def456 are the revision IDs.

daf
A: 

I wrote a tool that would get you most of the way there (printing out the entire contents of a file, as it was in SHA-1-WHATEVER. git-cat

You could either put a little shell script over that to do everything automatically, or the README.markdown file in that repository also gives references to where I learned all the stuff I needed to write the command.

RyanWilcox