Brendan Dawes
The Art of Form and Code

Quicker Git with Handy Bash Functions

In the course of a typical day I'll write a lot of Git commits, typing out git commit -a -m 'a message' and then doing a git push again and again. So to save time typing those things over and over again I've created short cut functions in my .bash_profile like this:

gc () {

    git commit -a -m "$1"
}

gp () {
    git push
}

gs () {

    git status
}

I now have gs, gc, gp for git status, git commit and git push respectively.

Less time typing all adds up to saving me time during the course of a day.