Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between "git whatchanged -- filename" and "git rev-list -- filename"

Tags:

git

git-log

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
like image 777
Senthil A Kumar Avatar asked Dec 07 '11 07:12

Senthil A Kumar


1 Answers

As mentioned in the git whatchanged man page:

Shows commit logs and diff output each commit introduces.
The command internally invokes git rev-list piped to git 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 log instead. The whatchanged command is essentially the same as git log but 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 log was invented by reading Linux kernel mailing list are trained to type it.

See more at "Difference between git-log and git-whatchanged?".

like image 143
VonC Avatar answered Oct 11 '22 13:10

VonC