Skip to content

Instantly share code, notes, and snippets.

@nikhilweee
Last active November 16, 2016 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikhilweee/75ea15afabdfbb18cda625364a9bf9f9 to your computer and use it in GitHub Desktop.
Save nikhilweee/75ea15afabdfbb18cda625364a9bf9f9 to your computer and use it in GitHub Desktop.
random-commit-messages
#! /bin/bash
# You can run this script directly from the terminal
# curl -s https://gist.githubusercontent.com/nikhilweee/75ea15afabdfbb18cda625364a9bf9f9/raw/ > /tmp/wtc.sh ; source /tmp/wtc.sh
# Just use `gitcommit` instead of `git commit -m` to get random commit messages from whatthecommit.com
# start
# checking for conflicts
unalias gitcommit
unalias commitmessage
# creating aliases
cat <<'END' >> ~/.bash_aliases
alias commitmessage="curl -s whatthecommit.com | sed -n -e '/<p>/,/<\/p>/p' | sed -e 's/<[^>]*>//' | tr -d '\n'"
alias gitcommit="git commit -m 'WTC: $(commitmessage)'"
END
# sourcing script
source ~/.bashrc
# done
echo "You can now use 'gitcommit' instead of 'git commit -m <message>' for random commit messages"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment