Re: How do I...
From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:41:56
On Fri, 6 May 2005, Frank Sorenson wrote:
Okay, I've got some "How can I?" questions. I hope I'm not the only one still working to "git it". How can I git a list of commits that have modified a particular file? For example, I'd like to do something like this: # git-file-revs Makefile f7eb55878f11575281add2a5726e483aed5e45bb aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Ok, I now have the perfect interface for _most_ uses of this thing. For example, let's say that you are interested in "what changed in the USB input layer lately". You can now do git-rev-list | git-diff-tree -p -v --stdin drivers/usb/input | less -S and you'll get some very readable output that tells you _exactly_ what has changed to any file in that subdirectory. Or, let's say that you're the author of the gt96100 ethernet driver (just to pick one that has both a .c and a .h file and that has had changes in the current git tree, you'd do: git-rev-list HEAD | git-diff-tree -p -v --stdin drivers/net/gt96100eth.* | less -S and it gives you _exactly_ what you want (ie thanks to how diff-tree works, you can give it any number of files or directories you're interested in). Normally, this thing will ignore merge commits, but if you want to see the merges that the changes came through (a merge _can_ have real changes of its own too), add the "-m" flag to the git-diff-tree thing. Try out the above examples on the current kernel tree (and with my most current git version as of five minutes ago - it shows up at least on gitweb, but I don't know if it's mirrored out with rsync yet). Very pretty. Very useful. Linus