4

Perform git commit with a random message from whatthecommit.com

git commit -m "$(w3m whatthecommit.com | head -n 1)"

January 5, 2018Jab2870

Explanation

What the Commit is a website that generates offbeat messages that may delight as Git commit messages.

git commit -m '...' is the command to commit pending changes with some log message that describes the change. Without -m '...', a text editor would open to write the message there.

w3m is a web browser that works in a terminal. We use it because it shows a web page content as plan text, so we don't need to parse HTML and get the generated message on the page.

With head -n 1 we get just the first line of the page content.

The entire w3m command is wrapped in a Command Substitution $(...), so that we can use its output inside the git commit -m '...'.

Limitations

Requires w3m.