Skip to content

Instantly share code, notes, and snippets.

@danieldbower
Created March 4, 2014 02:21
Show Gist options
  • Save danieldbower/9339101 to your computer and use it in GitHub Desktop.
Save danieldbower/9339101 to your computer and use it in GitHub Desktop.
Disable -m (message parameter) in git command in bashrc
function git {
for arg
do
if [[ $arg == -m* || $arg == -[^-]*m* ]]
then
annoy_me
return 1
fi
done
command git "$@"
}
function annoy_me {
echo ""
echo ""
echo "Stop using -m, $USER!"
echo ""
echo ""
echo "You are now in a 3 second time out."
echo ""
echo ""
echo "Try that commit again, and this time use the template"
echo ""
echo ""
settings=$(stty -g)
stty raw
sleep 3
stty "$settings"
}
@amsoell
Copy link

amsoell commented Jul 29, 2015

Love this. I found this because I keep using the -a parameter without thinking. Need to be more intentional with my commits, thanks for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment