Skip to content

Instantly share code, notes, and snippets.

@lexrus
Last active November 28, 2023 09:58
Show Gist options
  • Save lexrus/6fdf06cd06d71f3e199605cfaac12de5 to your computer and use it in GitHub Desktop.
Save lexrus/6fdf06cd06d71f3e199605cfaac12de5 to your computer and use it in GitHub Desktop.
Fork custom command which export weekly report of current git user.
【周报】11月01 ~ 11月05
本周贡献代码: +83行, -951行, 总行数: -868
2021-11-02: fix subl path
2021-11-01: Update README.md
2021-10-06: clean up
cd $path
DATE=`date -v-6d +"%Y-%m-%d"`
AUTHOR=`git config user.name`
LOG=`git log --branches --pretty=format:"\n%ad: %s" --date=short --after=$DATE --author="$AUTHOR"`
CHANGES=`git log --branches --date=short --after=$DATE --author="$AUTHOR" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "本周贡献代码: +%s行, -%s行, 总行数: %s\n", add, subs, loc }' -`
WEEKSTART=`date -v"monday" +"%-m月%d"`
TODAY=`date +"%-m月%d"`
REPORT="【周报】$WEEKSTART ~ $TODAY \n\n$CHANGES\n$LOG\n"
echo $REPORT
echo $REPORT | pbcopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment