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

Using "git log" to find the files patched at the same time as a named file

From
Zack Brown <zacharyb@gmail.com>
Date
Feb 3, 2010, 20:38 UTC
Message-ID
<218b69371002031238y6a377b06x76b8f8e87ea0ee46@mail.gmail.com>
Hi folks,

If I have a filename I'm interested in, and I want to find other files that have been modified in the same commits that modified the file I'm interested in, how could I do that with git?

If I give the command $ git log --name-only then the bottom of each log entry will list all the files that were modified by that commit. That's basically what I want, except that the command will list all log entries, not just the ones that modified the file I'm interested in.

If I give the command $ git log --name-only fs/fuse/file.c then the bottom of each log entry only lists fs/fuse/file.c, even if the very same commit showed up in the output from the previous command with multiple files in addition to that one. In other words, the "git log --name-only fs/fuse/file.c" command will only list fs/fuse/file.c as being changed, in commits that I know changed more than just that one file.

Is there a git command that will run in roughly the same amount of time as the ones given above (i.e. with only a single invocation of git), but that will only output the commits that affected the file I'm interested in, and that will also list any other files changed in those same commits?

Many thanks, Zack

-- 
Zack Brown
Next: Junio C Hamano
Message 1 of 5 in “Using "git log" to find the files patched at the same time as a named file”
  1. Zack BrownFeb 3, 2010
  2. Junio C HamanoFeb 3, 2010
  3. Zack BrownFeb 3, 2010
  4. Junio C HamanoFeb 3, 2010
  5. Zack BrownFeb 3, 2010

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.