Create a random commit
I often want to just create a commit when testing or showing off some git commands, but lack the creativity or bother to write some recognizable changes or commit messages.
On Mac or Linux, I use this nifty one-liner:
echo "Here's some random content: `random_word`" >> readme.txt; git commit -am "A random commit message: `random_word`"
Now you probably don't have this random_word command on your system yet. Here's what it does (worksforme on both OSX and Ubuntu):
#! /bin/bash
perl -e 'open IN, "</usr/share/dict/words";rand($.) < 1 && ($n=$_) while <IN>;print $n'
Example output:
commit d53935606f130bc99dd8ace491a819f706076057
Author: Thomas Ferris Nicolaisen <...>
Date: Fri Nov 23 09:18:32 2012 +0100
A random commit message: soundproofing
....
diff --git a/readme.txt b/readme.txt
....
+Here's some random content: freight
Written by Thomas Ferris Nicolaisen
Related protips
3 Responses
alias bump='echo "" >> .bump && git add .bump && git commit -m "$(curl -qs whatthecommit.com | sed -nE '\''s/<p>(.*)/\1/p'\'')" .bump' ;)
over 1 year ago
·
@oc cool!
replace echo "" >> .bump
with touch .bump
over 1 year ago
·
Improved alias bump='git commit --allow-empty -m "$(curl -qs whatthecommit.com | sed -nE '\''s/
(.*)/\1/p'\'')"'
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#