Search code examples
gitgit-commitgit-log

Is there a command to get the number of lines of code added, deleted, modified for a git commit?


I'm using below command

git log --pretty=format:"%h,%cn,%cs" which gives me the commit ID, committer name, and commit date. But what I need is the number of lines added/modified/deleted for every commit ID.

FYI: I'm not looking for difference between the commits.


Solution

  • Add --stat to your command. For example...

    $ git log --pretty=format:"%h,%cn,%cs" --stat
    
    e5a3f23256,Yuta Saito,2022-08-04
     ext/extmk.rb | 2 +-
     lib/mkmf.rb  | 6 +++++-
     tool/fake.rb | 1 +
     3 files changed, 7 insertions(+), 2 deletions(-)
    
    c69582a540,Yuta Saito,2022-08-04
     configure.ac | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)