Skip to content

Commit bfb1379

Browse files
kuangchanglanghemanth
authored andcommitted
add: Show how many lines does an author contribute (#121)
1 parent 3825548 commit bfb1379

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`.
135135
* [Show the author, time and last revision made to each line of a given file](#show-the-author-time-and-last-revision-made-to-each-line-of-a-given-file)
136136
* [Group commits by authors and title](#group-commits-by-authors-and-title)
137137
* [Forced push but still ensure you don't overwrite other's work](#forced-push-but-still-ensure-you-dont-overwrite-others-work)
138+
* [Show how many lines does an author contribute](#show-how-many-lines-does-an-author-contribute)
138139

139140
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
140141
<!-- @doxie.inject end toc -->
@@ -910,5 +911,18 @@ git shortlog
910911
git push --force-with-lease <remote-name> <branch-name>
911912
```
912913

914+
## Show how many lines does an author contribute
915+
```sh
916+
git log --author='_Your_Name_Here_' --pretty=tformat: --numstat | gawk '{ add += <!-- @doxie.inject start -->; subs += <!-- @doxie.inject end -->; loc += <!-- @doxie.inject start --> - <!-- @doxie.inject end --> } END { printf "added lines: %s removed lines: %s total lines: %s
917+
", add, subs, loc }' -
918+
```
919+
920+
921+
__Alternatives:__
922+
```sh
923+
git log --author='_Your_Name_Here_' --pretty=tformat: --numstat | awk '{ add += <!-- @doxie.inject start -->; subs += <!-- @doxie.inject end -->; loc += <!-- @doxie.inject start --> - <!-- @doxie.inject end --> } END { printf "added lines: %s, removed lines: %s, total lines: %s
924+
", add, subs, loc }' - # on Mac OSX
925+
```
926+
913927
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
914928
<!-- @doxie.inject end -->

tips.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,4 +392,8 @@
392392
}, {
393393
"title": "Forced push but still ensure you don't overwrite other's work",
394394
"tip": "git push --force-with-lease <remote-name> <branch-name>"
395+
},{
396+
"title": "Show how many lines does an author contribute",
397+
"tip": "git log --author='_Your_Name_Here_' --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 }' -",
398+
"alternatives": ["git log --author='_Your_Name_Here_' --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf \"added lines: %s, removed lines: %s, total lines: %s\n\", add, subs, loc }' - # on Mac OSX"]
395399
}]

0 commit comments

Comments
 (0)