Tiny script to bump version number

Posted on Jul 23, 2019

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.

1
2
3
4
5
 #!/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.

1
$ bump 1.4.1