Created
August 14, 2011 21:27
-
-
Save kristi/1145330 to your computer and use it in GitHub Desktop.
customize git commit message
This file contains hidden or 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
#!/bin/sh | |
# | |
# | |
# Customize the commit message: | |
# * Remove the list of untracked files | |
# * Add lines from diff of lines added and deleted | |
# | |
# Put this file in | |
# .git/hooks/prepare-commit-msg | |
# | |
case "$2,$3" in | |
merge,) | |
/usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; | |
*) ;; | |
esac | |
# customize message format | |
if [ "$2" == "" ] ; then | |
#echo "" >> "$1" | |
# Remove untracked files section | |
sed -i -e '/^# Untracked files:/,$ d' "$1" | |
# Print diff stat | |
#git diff --staged --stat 2>/dev/null | sed -e 's/^/#/' >> "$1" 2>/dev/null | |
echo "#" >> "$1" | |
echo "# Added Lines:" >> "$1" | |
git diff --staged -p -U0 --no-prefix -b 2> /dev/null | \ | |
sed -n -e 's/^+++ \(.*\)/# \1:/p; s/^[+]/#&/p; s/^@@.*/#@@/p' >> "$1" 2>/dev/null | |
echo "#" >> "$1" | |
echo "# Deleted Lines:" >> "$1" | |
git diff --staged -p -U0 --no-prefix -b 2> /dev/null | \ | |
sed -n -e 's/^--- \(.*\)/# \1:/p; s/^[-]/#&/p; s/^@@.*/#@@/p' >> "$1" 2>/dev/null | |
fi | |
This file contains hidden or 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
# Please enter the commit message for your changes. Lines starting | |
# with '#' will be ignored, and an empty message aborts the commit. | |
# On branch master | |
# Changes to be committed: | |
# (use "git reset HEAD <file>..." to unstage) | |
# | |
# modified: src/taikonome/Taikonome.as | |
# modified: taikonome.as3proj | |
# | |
# | |
# Added Lines: | |
# src/taikonome/Taikonome.as: | |
#@@ | |
#+ import flash.net.URLVariables; | |
#@@ | |
#+ protected var _tempoSlider:HUISlider | |
#+ protected var _volumeSlider:HUISlider | |
#@@ | |
#+ protected var _hashChangeTimer:uint = 0; | |
#+ protected var _varChangeTimer:uint = 0; | |
# | |
# Deleted Lines: | |
# src/taikonome/Taikonome.as: | |
#@@ | |
#@@ | |
#- protected var _slider:HUISlider | |
#- protected var _volume:HUISlider | |
#@@ | |
#- protected var _hashChangeTime:uint = 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment