2

I have a codebase for which I need to find out the number of lines still present today that were written before a given date (1 January 2018).

Is there a way to do this? I've looked into comparing the lines changed between a commit made that day and our last commit, but it also displays the lines/files deleted.

Graham Slick
  • 6,692
  • 9
  • 51
  • 87
  • Can you share what you already tried, even if it doesn't work yet? You might not be too far from it. – Romain Valeri Apr 12 '19 at 14:25
  • 1
    take a look on answer given by @Steffen G in https://stackoverflow.com/questions/37211955/git-number-of-lines-not-changed-since-specific-commit?answertab=votes#tab-top . I think this will solve your problem. – Shantanu Singh Apr 12 '19 at 14:54

1 Answers1

0

If you have two commit IDs you can do:

git diff --shortstat <COMMIT_ID> <SECOND_COMMIT_ID>

This will return the amount of files changed, insertions and deletions example:

25 files changed, 378 insertions(+), 373 deletions(-)
Esteban Garcia
  • 2,171
  • 16
  • 24