git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How do I...

From
Linus Torvalds <torvalds@osdl.org>
Date
May 6, 2005, 16:13 UTC
Message-ID
<Pine.LNX.4.58.0505060905090.2233@ppc970.osdl.org>
In-Reply-To
<427B3DB3.4000507@tuxrocks.com>
On Fri, 6 May 2005, Frank Sorenson wrote:
Show 10 quoted lines
> 
> 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
Previous: Frank SorensonNext: Junio C Hamano
Message 8 of 24 in “How do I...”
  1. Frank SorensonMay 6, 2005
  2. Thomas GlanzmannMay 6, 2005
  3. Thomas GlanzmannMay 6, 2005
  4. Dave KleikampMay 6, 2005
  5. Frank SorensonMay 6, 2005
  6. Dave KleikampMay 6, 2005
  7. Frank SorensonMay 6, 2005
  8. Linus TorvaldsMay 6, 2005
  9. Junio C HamanoMay 6, 2005
  10. Frank SorensonMay 6, 2005
  11. Daniel BarkalowMay 6, 2005
  12. Frank SorensonMay 6, 2005
  13. Linus TorvaldsMay 6, 2005
  14. David WoodhouseMay 6, 2005
  15. Linus TorvaldsMay 6, 2005
  16. David WoodhouseMay 6, 2005
  17. Linus TorvaldsMay 6, 2005
  18. David WoodhouseMay 6, 2005
  19. Linus TorvaldsMay 6, 2005
  20. David WoodhouseMay 7, 2005
  21. Thomas KolejkaMay 6, 2005
  22. David WoodhouseMay 6, 2005
  23. Benjamin HerrenschmidtMay 7, 2005
  24. Linus TorvaldsMay 6, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.