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
There has been at least two different scripts for this posted, and one C source code version. I just haven't integrated them, because I'm an idiot, and too much choice makes me run around in small circles and clucking. Guys - whoever wrote one of the scripts, can you please send out your current version to the git list and cc me, and explain why yours is superior to the other peoples version. Please? But I might cook something up myself too.
How can I output a list of the filename(s) modified by a particular commit? (for example) # git-commit-info files 6741f3a7f9922391cd02b3ca1329e669497dc22f
You need to use "git-tree-diff", but it doesn't want one commit, it wants two. In the case of "what did this one commit change", you need to look up its parents (there can be more than one! In fact, the current git repository has one entry with _five_ parents), and then you need to select one of them as the reference. In other words, if it's a merge, you need to select which side you care about.
Can I use cg-log to output just the information about a particular commit? (I don't need all the commits, just the one I'm interested in).
You don't even need cg-log for that. If you already know which commit you're interested in, just output that one commit: git-cat-file commit <commit-name-here>
After doing a cg-update, can I cg-log just the changes since the last update? Alternatively, how can I tell cg-log I'm caught up, and don't need anything historical?
I don't know how to do with with cg-update, but if you use the "git-pull-script" thing, you can do git-diff-tree -p ORIG_HEAD HEAD which shows you what the pull brought in.
Can I do these with git/cogito, or will I need to start diving deeper into the code?
Apart from finding the "which commit changed this", it's all trivially doable. And the "which commit" thing is also trivially doable if you just find the script.. Linus