Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
626 views
in Technique[技术] by (71.8m points)

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

  1. Given this answer to another question, and
  2. given that the man pages for both git-log and git-whatchanged say they pull from git-rev-list...

...what then is the difference between the two commands? Why bother having both of them?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The commit 52f425e1 (August, 30th 2013) mentions:

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

'git log' only allowed you to view the log messages and no diffs when it was added in early June 2005. It was only in early April 2006 that the command learned to take diff options.
Because of this, power users tended to use 'whatchanged' that already existed since mid May 2005 and supported diff options.


That is what the new version of the man page for git whatchanged will say now:

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.

As torek comments, the git whatchanged equivalent would be:

git log --raw --no-merges

(That would avoid this question)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...