Last active
April 28, 2016 08:00
-
-
Save leonid-ed/fb88044aa5daa143849b005ad38346d4 to your computer and use it in GitHub Desktop.
.git/hooks/prepare-commit-msg showing latest 15 commit messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The MIT License (MIT) | |
# Copyright (c) 2016 Leonid Edrenkin | |
# | |
#!/bin/bash | |
case "$2,$3" in | |
message,HEAD) | |
;; | |
*) | |
# obtain commit history | |
c_history=$(git log -15 --pretty=format:'%s' \ | |
--abbrev-commit --date=relative | perl -lne 'print "# $_"') | |
echo -e "# Recent commit messages:" >> "$1" | |
echo -e "$c_history" >> "$1" | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment