Is there an easy way to calculate the changes (lines added, lines deleted...) grouped by Author, between two commits?
How many changes do Author X made in a feature branch, that are not in the master branch?
Is there an easy way to calculate the changes (lines added, lines deleted...) grouped by Author, between two commits?
How many changes do Author X made in a feature branch, that are not in the master branch?
This will output the number of added/removed lines for a given author introduced in <branch>
compared to master
:
git log master..<branch> --author="<author>" --pretty=tformat: --numstat \
| gawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n", add, subs, loc }' -
Substitute <branch>
and <author>
(could be a part of author's name) accordingly.
I have slightly modified solution from this answer, in order to filter commits out.
There are a couple options: git diff
or git log
.
The git diff
command will show you the changes to tracked files in your work tree that haven't been added to the index.
The git log
command lets you do things like list project history, filter it, or search for specific changes. git log --author="<pattern>"
will search commits by a particular author.
Each command of course has a lot of different options that you can use to find the specific information that you are looking for.