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

[RFH] Finding all commits that touch the same files as a specific commit

From
SRSverre Rabbelier <alturin@gmail.com>
Date
Jul 12, 2008, 15:58 UTC
Message-ID
<bd6139dc0807120858vc058451lb10933b5225c8521@mail.gmail.com>
Heya,

Currently I do the following: $git diff-tree --name-status --no-commit-id -r <hash> To get all the files touched by the commit, I do: $git rev-list HEAD -- all the returned paths here This works perfectly, except when the subtree merge strategy is used, since in that case I get (example from git.git): $ git diff-tree --name-status --no-commit-id -r 5821988f97b827f6ba81dfeebff932067c88ba6c M git-gui.sh M lib/diff.tcl $ git rev-list HEAD -- git-gui.sh lib/diff.tcl $

Now it was noticed on #git that git log has a --follow argument which -does- catch the rename, but it only works on one file at a time. So, my question is this: How do I find all commits that touch the same files as a specific commit? I have described my current approach above, which does not work when the subtree merge strategy is used. I am not stuck to this approach though, if someone comes up with a better way to do this than with 'git diff-tree' / 'git rev-list' I'm fine by that. I provided with my current approach in the hope that someone comes up with a similar solution which means I'll have to edit less ;).

-- 
Cheers,

Sverre Rabbelier
Next: Junio C Hamano
Message 1 of 7 in “[RFH] Finding all commits that touch the same files as a specific commit”
  1. Sverre RabbelierJul 12, 2008
  2. Junio C HamanoJul 13, 2008
  3. Sverre RabbelierJul 13, 2008
  4. Johannes SchindelinJul 13, 2008
  5. Sverre RabbelierJul 14, 2008
  6. Johannes SchindelinJul 14, 2008
  7. Sverre RabbelierJul 14, 2008

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.