What flags need to be set on `git log` to make it have similar output to `git whatchanged`?
Asked Answered
W

1

4

Per: Difference between git-log and git-whatchanged?

Encourage new users to use 'log' instead. These days, these commands are unified and just have different defaults.

I only recently discovered git whatchanged but found its output:

commit deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
Author: Egg Sample <[email protected]>
Date: Mon Jan 28 16:32:04 2019 -0800

    change some files

:100777 100644 abaddad1 feeb1e42 M      src/changemymode.txt
:100644 100644 1234abcd abcd1234 M      src/changemycontent.txt
:000000 100755 00000000 6600abcd A      src/addme.txt
:100755 000000 feed1bee 00000000 D      src/deleteme.txt

useful for a particular workflow I had recently (involving a branch with many file mode changes). Out of curiosity, what would I need to do to make git log behave in such a manner, i.e.:

  • show the commit information,
  • the old mode, new mode, hashes, Modified|Added|Deleted and filenames of the files that changed
  • and not the diffs themselves
  • (and exclude merges by default, which is also called out as git whatchanged behavior).

I figured it might be something in the --stat or --format options, but git log --help doesn't seem to mention anything about getting the file modes and object hashes printed in conjunction with these options, and a quick scan of said document doesn't have anything jump out at me.

Woods answered 29/1, 2019 at 0:55 Comment(2)
git whatchanged = git log --raw (well, and, according to the whatchanged page, --no-merges as well).Trauner
@Trauner Welp, that'll do it. Now I know that the format in question is "the summary of changes in raw diff format." Thanks!Woods
B
1

Just so this question is not left unanswered:

By this revised answer, newer versions of git explain this on man git-whatchanged

The whatchanged command is essentially the same as git-log(1) but defaults to show the raw format diff output and to skip merges.

So:

git log --raw --no-merges
Backsight answered 13/11, 2019 at 3:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.