Gitology Recipe: List Files That Have Changed Between Two RevisionsNote: This article is a draft, is subject to revision, and is possibly incomplete. This notice will be removed when article is final.
It's often useful to see which files have changed between two revisions. Fortunately, it's as easy as it is useful. To list all the files that have changed between two revisions, simply:
where foo is one revision and bar is the other. For example, let's say you have a repository containing three files: a, b, and c. You modify "a" and commit. Then you modify "b" and commit. You'll need the revision IDs for git diff. There are multiple ways to get the IDs, but in our example, I use git log as shown below. (Note that I'm piping the output to egrep to keep the output terse--only the commit lines and the date stamps will be printed. You needn't do this. Also, you will likely be plucking the commit IDs out of gitk or an equivalent tool.)
Now, list the files that have changed between the two most recent revisions, like so:
That's it! Only "b" changed. In real life, the file listing will doubtlessly be longer and more useful. |