2

I would like to get number of lines of code changed per commit. Is it possible?

I am trying the following command but it is giving numstat details for commits before my specified commit as well.

git log --numstat [commit hash]
artsylar
  • 2,648
  • 4
  • 34
  • 51
  • What is the exact output you want? – Tim Biegeleisen Sep 18 '19 at 01:20
  • Thank you for your comment. I basically want something like this Commit Date, Commit Hash, Subject/Message, No. of files modified, Lines Added, Lines Removed – artsylar Sep 18 '19 at 01:21
  • 2019-08-01, 3002fd1f2, '#11063 commit message', 1, 10, 13 – artsylar Sep 18 '19 at 01:22
  • 1
    This links is exactly what you need. https://stackoverflow.com/questions/2528111/how-can-i-calculate-the-number-of-lines-changed-between-two-commits-in-git/2528129 – vS12 Sep 18 '19 at 01:22
  • Thank you for that but it seems like I need to have 2 commits. – artsylar Sep 18 '19 at 01:25
  • @artsylar It only makes sense to speak of lines changed in going from one commit to another. So, in your case, "one" commit means that you started at some previous commit, did a delta, and then ended up in some other commit. – Tim Biegeleisen Sep 18 '19 at 01:28
  • I was able to output something like this actually 2019-08-01, 3002fd1f2, '#11063 Update xxxxxxxx, xxxxx', 1 file changed, 10 insertions(+), 13 deletions(-) – artsylar Sep 18 '19 at 01:30
  • But I don't need "file changed", "insertions(+)" and "deletions(-) texts. – artsylar Sep 18 '19 at 01:31
  • Possible duplicate of [How can I calculate the number of lines changed between two commits in git?](https://stackoverflow.com/questions/2528111/how-can-i-calculate-the-number-of-lines-changed-between-two-commits-in-git) – alex Sep 18 '19 at 14:41

0 Answers0