list all user commits history with line changes
Copy $ git log ${GIT_OPT} --author= "marslo" --oneline --shortstat [--no-merges]
[!TIP] within time slots : --after="2021-01-01" --before="2022-01-01"
Copy GIT_OPT = '--after="2021-01-01" --before="2022-01-01"'
Copy $ git shortlog -s -n ${GIT_OPT} | awk '{ sum += $1; } END { print sum; }'
304
Copy $ git shortlog -sn ${GIT_OPT}
101 marslo
...
# or with email
$ git shortlog -sne ${GIT_OPT}
101 marslo < marslo@xxx.co m >
...
# or specific account only
$ git shortlog -sne ${GIT_OPT} --author= 'marslo'
101 marslo < marslo@xxx.co m >
# or via `rev-list --count`
$ git rev-list HEAD ${GIT_OPT} --author= 'marslo' --count
101
Copy $ git ls-files -z |
xargs -0n1 git blame -w |
perl -n -e '/^.*?\((.*?)\s+[\d]{4}/; print $1,"\n"' |
sort -f |
uniq -c |
sort -nr
# or using sed instead of perl
$ git ls-files -z |
xargs -0n1 git blame -w -C |
sed -r 's/^[^(]+\((.*) [0-9]{4}-.*/\1/' |
sed -r 's/ +$//' |
sort -f |
uniq -c |
sort -nr
Copy $ git log ${GIT_OPT} --numstat --pretty=tformat: |
grep -v '^-' |
awk '{ add+=$1; remove+=$2; loc += $1 - $2 } END \
{ printf ".. added: %s, removed: %s, total: %s .", add, remove, loc }'
.. added: 18111, removed: 11153, total: 6958 .
# or : https://stackoverflow.com/a/48575013/2940319
$ git log ${GIT_OPT} --pretty=format: '' --numstat --author |
awk 'NF' |
awk '{insertions+=$1; deletions+=$2} END \
{print NR, "files changed,", insertions, "insertions(+),", deletions, "deletions(+)"}' ;
# or : https://stackoverflow.com/a/4593065/2940319
# https://gist.github.com/pstadler/4722416
$ git log --shortstat ${GIT_OPT} --author 'marslo' |
grep "files\? changed" |
awk '{files+=$1; inserted+=$4; deleted+=$6} END \
{print ".. files changed :", files, "; lines inserted :", inserted, "; lines deleted :", deleted , ";"}'
.. files changed : 1046 ; lines inserted : 14096 ; lines deleted : 8871 ;
# or
$ git log --shortstat ${GIT_OPT} --author= 'marslo' --oneline --format=tformat: |
awk '{ files+=$1; inserted+=$4; deleted+=$6 } END \
{ print ".. files changed :", files, "\n.. lines inserted :", inserted, "\n.. lines deleted :", deleted }'
.. files changed : 1046
.. lines inserted : 14096
.. lines deleted : 887
# or : https://gist.github.com/eyecatchup/3fb7ef0c0cbdb72412fc
$ git log --author= "marslo" --after= "2022-01-01" --pretty=tformat: --numstat |
awk '{ inserted+=$1; deleted+=$2; delta+=$1-$2; ratio=deleted/inserted } END \
{ printf "Commit stats:\n- Lines added (total).... %s\n- Lines deleted (total).. %s\n- Total lines (delta).... %s\n- Add./Del. ratio (1:n).. 1 : %s\n", inserted, deleted, delta, ratio }' -
Commit stats:
- Lines added (total).... 14090
- Lines deleted (total).. 8877
- Total lines (delta).... 5213
- Add./Del. ratio (1:n).. 1 : 0.630021
Copy $ git log "${GIT_OPT}" --author= 'marslo' --numstat --pretty=tformat: |
grep -v '^-' |
awk '{ add+=$1; remove+=$2; loc += $1 - $2 } END { printf ".. added: %s, removed: %s, total: %s .", add, remove, loc }'
.. added: 14090, removed: 8877, total: 5213 .
Copy # linux
$ git log --pretty=format: --name-only | sed '/^\s*$/d' | sort | uniq -c | sort -rg | head -100
# windows
$ git log --pretty=format: --name-only | sort | uniq -c | sort /R | head -100
Copy $ gem install nova_git_stats
$ /usr/local/lib/ruby/gems/3.3.0/gems/nova_git_stats-2.4.1/bin/git_stats generate -o stats
Copy $ export NODE_TLS_REJECT_UNAUTHORIZED= 0
$ npm config set strict-ssl false
$ npm i -g git-stats
(node:2823) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
/usr/local/bin/git-stats - > /usr/local/lib/node_modules/git-stats/bin/git-stats
> git-stats@3.1.1 postinstall /usr/local/lib/node_modules/git-stats
> node scripts/migration/2.0.0.js
+ git-stats@3.1.1
added 100 packages from 57 contributors in 15.748s
# optional
$ npm i -g git-stats-importer
$ npm i -g git-stats-html # usage $ git-stats --raw | git-stats-html -o out.html
$ npm i -g pageres-cli # usage $ pageres out.html 775x250
$ curl -sk https://raw.githubusercontent.com/IonicaBizau/git-stats/master/scripts/init-git-post-commit | bash
Setting up git-stats hooks.
Set new global git template dir at /Users/marslo/.git-templates
Successfully set up git-stats hook at /Users/marslo/.git-templates/hooks/post-commit.
Copy # install
pip install git-fame
# completion
# osx
$ curl -fsSL https://raw.githubusercontent.com/casperdcl/git-fame/main/git-fame_completion.bash \
-o /usr/local/etc/bash_completion.d/git-fame_completion.bash
# linux
$ sudo curl -fsSL https://raw.githubusercontent.com/casperdcl/git-fame/main/git-fame_completion.bash \
-o /usr/share/bash-completion/completions/git-fame_completion.bash
# centos only
$ sudo curl -fsSL https://raw.githubusercontent.com/casperdcl/git-fame/main/git-fame_completion.bash \
-o /etc/bash_completion.d/git-fame_completion.bash
# usage
vim $ git fame --cost hour,month --since= '5 days ago'
Processing: 100% | ███████████████████████████████████████████████████████ | 1/1 [00:00<00:00, 10.02repo/s]
Total commits: 23
Total ctimes: 133
Total files: 133
Total hours: 28.3
Total loc: 1838
Total months: 5.5
| Author | hrs | mths | loc | coms | fils | distribution |
| :------------------- | ------: | -------: | ------: | -------: | -------: | :---------------- |
| dkearns | 2 | 2 | 658 | 3 | 20 | 35.8/13.0/15.0 |
| lilydjwg | 3 | 1 | 325 | 2 | 15 | 17.7/ 8.7/11.3 |
| Christian Brabandt | 4 | 1 | 300 | 6 | 46 | 16.3/26.1/34.6 |
| zeertzjq | 2 | 1 | 176 | 3 | 19 | 9.6/13.0/14.3 |
| Sergey Vlasov | 2 | 0 | 126 | 1 | 9 | 6.9/ 4.3/ 6.8 |
| Casey Tucker | 2 | 0 | 83 | 1 | 11 | 4.5/ 4.3/ 8.3 |
| thinca | 2 | 0 | 61 | 1 | 4 | 3.3/ 4.3/ 3.0 |
| kawaii-Code | 2 | 0 | 32 | 1 | 2 | 1.7/ 4.3/ 1.5 |
| user202729 | 2 | 0 | 28 | 1 | 1 | 1.5/ 4.3/ 0.8 |
| VanaIgr | 2 | 0 | 18 | 1 | 3 | 1.0/ 4.3/ 2.3 |
| h_east | 2 | 0 | 16 | 1 | 1 | 0.9/ 4.3/ 0.8 |
| Melker Ulander | 2 | 0 | 11 | 1 | 1 | 0.6/ 4.3/ 0.8 |
| gi1242 | 2 | 0 | 4 | 1 | 1 | 0.2/ 4.3/ 0.8 |
[!NOTE|label:references:]
git effort usage Displays "effort" statistics, currently just the number of commits per file, showing highlighting where the most activity is. The "active days" column is the total number of days which contributed modifications to this file.
Copy $ git effort --above 15 devops/*
path commits active days
devops/git..................... 111 88
devops/adminTools.md........... 42 27
devops/awesomeShell.md......... 34 16
devops/ssh.md.................. 16 15
$ git effort -- --since= '3 months ago'
path commits active days
devops/awesomeShell.md................................................................................. 34 16
vim/plugins.md......................................................................................... 26 17
vim/deprecated.md...................................................................................... 21 14
linux/basic.md......................................................................................... 17 15
SUMMARY.md............................................................................................. 16 9
linux/apt-yum.md....................................................................................... 15 14
linux/devenv.md........................................................................................ 14 9
devops/adminTools.md................................................................................... 14 10
cheatsheet/bash/sugar.md............................................................................... 14 13
cheatsheet/character/character.md...................................................................... 13 9
osx/apps.md............................................................................................ 12 9
devops/git/config.md................................................................................... 11 10
linux/system.md........................................................................................ 9 7
virtualization/kubernetes/cheatsheet.md................................................................ 8 7
vim/troubleshooting.md................................................................................. 8 8
[!NOTE|label:references:]
Copy $ git summary --line
project : mbook
lines : 114620
authors :
114563 marslo 100.0%
40 Not Committed Yet 0.0%
17 marslojiao 0.0%
$ git log --pretty=format: "%H" --since= '3 months ago' | tail -1
435c4f75edb840a5f2c10991fc1d072eb4f51e50
$ git summary 435c4f75edb840a5f2c10991fc1d072eb4f51e50..
project : mbook
repo age : 3 years, 4 months
branch: : marslo
last active : 11 minutes ago
active on : 56 days
commits : 130
uncommitted : 1
authors :
130 marslo 100.0%
[!NOTE|label:references:]
Copy $ git count
# or
$ git count --all
marslo (871)
marslojiao (1)
total 872
Copy $ git guilt $( git log --since= "3 weeks ago" --format= "%H" | tail -1 ) HEAD
marslo ++++++++++++++++++++++++++++++++++++++++++ ( 122886 )
[!NOTE] modified from git-guilt to show the line changes per file
Copy $ git victim $( git log --since= "3 weeks ago" --format= "%H" | tail -1 ) HEAD
docs/linux/tools.md +++++++++++++++++++++++++++++++++++++++++++++(643)
docs/linux/basic.md +++++++++++++++++++++++++++++++++++++++++++++(381)
docs/linux/util/files 218 docs/linux/util/files&chars.mdchars.md +++++++++++++++++++++++++++++++++++++++++++++(218)
docs/linux/util/files 172 books/linux/files&chars.mdchars.md +++++++++++++++++++++++++++++++++++++++++++++(172)
docs/linux/ubuntu/repo.md +++++++++++++++++++++++++++++++++++++++++(89)
docs/cheatsheet/bash/bash.md +++++++++++++++++++++++++ ( 56 )
docs/linux/ubuntu/apps.md ++ ( 8 )
...