Efficiency is something each of us developers should strive to improve.

If you spot any patterns or repetitions in your workflow, ask yourself: can this be automated?

Over the course of a lifetime, a month... or even a week—the seconds you spend doing small, seemingly 'meaningless' tasks really add up.

Along with this, monotonous tasks can be overlooked and can have a negative impact over the long-run.

For example... when you're doing something hundreds of times a day, you can end up slacking.

I'm (not) guilty of this 🙄, I swear...

I'd have to read through the code to know what I've done!

In this quick guide, we'll set up a shell function to speed up our Git workflow and minimise the risk of the above happening to you!


When working with Git from the command line, the most common commands you'll use are add, commit and push These 'transfer' your files to the repository.

Which looks like this:

git add .
git commit "Commit message here"
git push

"oh that only takes 30 seconds" you may be thinking

But what if it could take 10 seconds?

That 20 seconds saved will resort to hours of the course of the year (if you push files as often as me).

Ok, let's do it!

Firstly, open up your ZSH config file. We'll use nano in this case:

nano ~/.zshrc

Now let's add our new function:

function gitall() {
    git add .
    if [ "$1" != "" ]
        git commit -m "$1"
        git commit -m update
    git push

What does this do?

Firstly, it prepares all the files (and children) of the current directory to be committed. (git add .)

It then checks if a parameter has been passed through ($1)

If there is, it will add the parameter as a git commit message, if not it will just add 'update'

It will then push the files to the repository

Testing it out

Restart ZSH

 . ~/.zshrc

We can now use our new function as follows:

 gitall 'This commit message is for testing my function!'

And that should be it!

Let me know in the comments below if you have any other shorthands you like to use