Skip to content

Instantly share code, notes, and snippets.

@awesome
Created August 29, 2018 01:19
Show Gist options
  • Save awesome/55245ee7ded6dd4f209dbac8c64a74b8 to your computer and use it in GitHub Desktop.
Save awesome/55245ee7ded6dd4f209dbac8c64a74b8 to your computer and use it in GitHub Desktop.
Per Aaron's request for "git commit fortune" as in https://en.wikipedia.org/wiki/Fortune_(Unix)
Last login: Tue Aug 28 17:47:56 on ttys015
$ cat >> ~/.bashrc <<EOS
> function commit_fortune { curl -s "https://whatthecommit.com"| tr -d "\n\r" | perl -pe 's/.*<div id="content"><p>(.*)(?:<\/p><p class="permalink">).*/\1/';}
> function gcf { git commit -am "\$(commit_fortune)";}
> export -f commit_fortune
> export -f gcf
> EOS
$ source ~/.bashrc
$ echo $(commit_fortune)
I'm totally adding this to epic win. +300
$ echo 'awesome' > awesome.txt
$ gcf
[master 557cab0] I must sleep... it's working... in just three hours...
1 file changed, 1 insertion(+)
$ git log -1
commit 557cab00d27178b7d7634affeec19686dba1cd60 (HEAD -> master)
Author: So Awesome Man <[email protected]>
Date: Tue Aug 28 18:03:27 2018 -0700
I must sleep... it's working... in just three hours...
cat >> ~/.bashrc <<EOS
function commit_fortune { curl -s "https://whatthecommit.com"| tr -d "\n\r" | perl -pe 's/.*<div id="content"><p>(.*)(?:<\/p><p class="permalink">).*/\1/';}
function gcf { git commit -am "\$(commit_fortune)";}
export -f commit_fortune
export -f gcf
EOS
source ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment