Search code examples
gittortoisegit

count line changes with git?


Is there a simple way I can ask git for the amount of lines I added (or add and removed) in a specific date range?

I'm using git on Windows, Linux and TortoiseGit(Windows)


Solution

  • Building upon Seth Robertson's answer, (+1 Seth!) awk will tally up the columns for you:

    % git log --stat --author $(git config --get user.email) --since="last year" --until="last month" | awk -F',' '/files? changed/ {
        files += $1
        insertions += $2
        deletions += $3
        print
    }
    END {
        print "Files Changed: " files
        print "Insertions: " insertions
        print "Deletions: " deletions
        print "Lines changed: " insertions + deletions
    
    }'