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

git-range-diff ignoring commit message changes

From
Gwyneth Morgan <gwymor@tilde.club>
Date
Jan 15, 2024, 19:40 UTC
Message-ID
<ZaWKNI5qLPf4P75A@tilde.club>

Is there a way to make git-range-diff to ignore commit messages when considering if commits are identical? When range-diffing long series there are cases where I would like to check at a glance whether the code has changed, and only when the code has changed do I want to see the change in commit message too.

It seems I can approximate what I want by tweaking range-diff's source like this but I couldn't tell if there was an actual option:

diff --git a/range-diff.c b/range-diff.c
index c45b6d849c..fd421b7b99 100644
--- a/range-diff.c
+++ b/range-diff.c
@@ -59,7 +59,7 @@ static int read_patches(const char *range, struct string_list *list,
 		     "--output-indicator-old=<",
 		     "--output-indicator-context=#",
 		     "--no-abbrev-commit",
-		     "--pretty=medium",
+		     "--pretty=format:commit %H",
 		     "--show-notes-by-default",
 		     NULL);
 	strvec_push(&cp.args, range);

This ignores commit message changes entirely, but it would be nice to
have an option to only see commit message changes when the code diff has
changed. It would also be convenient to have a way to only consider
changes in the title of commits but ignore the message body (equivalent
to "--pretty=short" above).

You could get some of this information with git-cherry, but that is
suited for different uses (only cares about new commits on one side,
doesn't show diffs) and would take more effort than just ignoring the
commit messages in the current range-diff output.
Message 1 of 1 in “git-range-diff ignoring commit message changes”
  1. Gwyneth MorganJan 15, 2024

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.