mike.zarandona.com

coffee lover, dog person, frontend engineer

Front-End Toolbelt: `--allow-empty`

Posted June 1st, 2017 in FrontEnd-Toolbelt tagged JavaScript, Git


Recently I’ve been working on an automated deployment system for projects, which can do useful things like allow for super simple pushes, and makes my deployments way less susceptible to error (and to be honest less scary).

However - the tedium of the project came in the form of lots of commits. So many, that I was developing this strange half-robotic, half-smashing-keys-without-really-thinking-about-it trance; I was becoming a commit robot who could fire off a whitespace change to a README.md file in record time. The problem: I was spending a lot of time committing, and not a ton of time actually writing code. Plus the content of my robo-commits were gross and sloppy, and terribly prone to error.

Fortunately I stumbled on the --allow-empty flag, which allows you to commit something like:

$ git commit --allow-empty -m "Bump for deploy script testing"

Now with the three line succession of:

$ git commit --allow-empty -m "Bump for deploy script testing"
$ git push origin
$ git push prod master

Each bump, push, and deploy is now a mater of tapping through the last three lines of terminal history.

Your commit history is (hopefully) cleaner, you’re happier, the air smells fresher, food tastes better, and maybe you’re going to get yourself that haircut.