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 <mail@example.com>
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.

merkworku
  • 85
  • 5
  • 2
    `git whatchanged` = `git log --raw` (well, and, according to the whatchanged page, `--no-merges` as well). – torek Jan 29 '19 at 00:56
  • @torek Welp, that'll do it. Now I know that the format in question is "the summary of changes in raw diff format." Thanks! – merkworku Jan 29 '19 at 00:58

1 Answers1

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
MestreLion
  • 12,698
  • 8
  • 66
  • 57