Handy Git Aliases

Posted in Web Development on the 16th of February 2015 by @aaronrutley

I was chatting to a mate over a coffee this morning about how I’ve been automating some of my repetitive command line tasks, I thought it would be worth sharing a few handy git aliases that I use in my development workflow.

I use Oh My Zsh which has a git plugin that has a bunch of handy alaises, however I still found myself repeating the same few commands in sequence over and over.

Git Commit (gc)

These days I’m constantly committing code as features are completed or bugs are fixed, as this is a very repetitive command line process I figured I could automate some of these steps to save time & increase my productivity.

This alias is essentially a simple bash function that runs a few repetitive tasks such as:

  1. It runs ‘git status’ (to remind me which files have been added / modified )
  2. I then runs ‘git commit’ (adding all modified files in all directories)
  3. It then asks you to enter a commit message
  4. It then runs a git push

Other git aliases

Here are a couple of other aliases that I use on a regular basis

  • gs = Git Status (in the minimised output)
  • gp = Git Push
  • gremove = Removes the git repo from the current directory (use with care).

Share this post