Skip to content

Instantly share code, notes, and snippets.

@tenfyzhong
Last active December 15, 2018 07:28
Show Gist options
  • Save tenfyzhong/792aba96820f79b9eab4660286af9903 to your computer and use it in GitHub Desktop.
Save tenfyzhong/792aba96820f79b9eab4660286af9903 to your computer and use it in GitHub Desktop.
log git commit
toplevel=$(git rev-parse --show-toplevel)
log_file=$HOME/.commit_log/$(date +%Y)_week_$(date +%U).log
message=$(git log -1 --pretty=format:'%H%n%cd%n%s%n%b')
mkdir -p "$HOME/.commit_log"
touch "$log_file"
printf "%s\n$message\n--------------------------------------------------------------------------------\n" "$toplevel" >> "$log_file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment