Tom Gamon

Tiny script to bump version number

I often find myself doing the following:

  1. Go to repo
  2. Open VERSION file
  3. Change the version number
  4. Add the file to git
  5. Commit with the message ‘Bump version to $1’

This is a tiny script which automates the above.

 #!/bin/bash
[ $# -eq 1 ] || exit
echo $1 > VERSION
git add VERSION
git commit -m "Bump version to $1"

I generally alias this to something like bump so I can quickly bump up the version number.

$ bump 1.4.1