What is the difference between the 2 commands below. I see different outputs.
Both are run from a clone having a single branch.
git whatchanged -m -- foo.c
git rev-list --reverse --all -- foo.c
As mentioned in the git whatchanged man page:
Shows commit logs and diff output each commit introduces.
The command internally invokesgit rev-listpiped togit diff-tree, and takes command line options for both of these commands.
The "piped to git diff-tree" would explain the different output between both commands.
You can find an example of git rev-list combined with a git diff in "In git, how can I get the diff between all the commits that occured between two dates?".
Update September 2013:
The new version of the man page for git whatchanged now emphasizes:
New users are encouraged to use
git loginstead. Thewhatchangedcommand is essentially the same asgit logbut defaults to show the raw format diff output and to skip merges.The command is kept primarily for historical reasons; fingers of many people who learned Git long before
git logwas invented by reading Linux kernel mailing list are trained to type it.
See more at "Difference between git-log and git-whatchanged?".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With