How to have git log show filenames like svn log

SVN's log has a "-v" mode that outputs filenames of files changed in each commit, like so:

jes5199$ svn log -v
------------------------------------------------------------------------
r1 |   jes5199 | 2007-01-03 14:39:41 -0800 (Wed, 03 Jan 2007) | 1 line
Changed paths:
   A /AUTHORS
   A /COPYING
   A /ChangeLog
   A /EVOLUTION
   A /INSTALL
   A /MacOSX

Is there a quick way to get a list of changed files in each commit in git?


For full path names of changed files:

git log --name-only

For full path names and status of changed files:

git log --name-status

For abbreviated pathnames and a diffstat of changed files:

git log --stat

There's a lot more options, check out the docs.


NOTE: git whatchanged is deprecated, use git log instead

New users are encouraged to use git-log[1] instead. The whatchanged command is essentially the same as git-log[1] 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.


You can use the command git whatchanged --stat to get a list of files that changed in each commit (along with the commit message).

References

  • https://git-scm.com/docs/git-whatchanged

  • git show is also a great command.

    It's kind of like svn diff , but you can pass it a commit guid and see that diff.

    链接地址: http://www.djcxy.com/p/45724.html

    上一篇: 如何和/或为什么Git合并比SVN更好?

    下一篇: 如何让git log显示像svn log这样的文件名