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

Time:10-14

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.

CodePudding user response:

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(-)

CodePudding user response:

You may be after --shortstat, which will tell you how many files changed, how many lines were added ("inserted") and how many lines were deleted.

You can use it with git show and git log.

  • Related