Git Aliases That Will Save You Hours Every Week

Git Aliases That Will Save You Hours Every Week

Maya AhmedBy Maya Ahmed
Quick TipTools & WorkflowsGitProductivityDeveloper ToolsCommand LineWorkflow Optimization

Quick Tip

Add 'git config --global alias.st status' to your shell and never type 'git status' again—just use 'git st' instead.

Git aliases are shortcuts that replace long, repetitive commands with short, memorable ones. If you're typing git commit -m "message" fifty times a day, you're wasting keystrokes — and mental energy. This post covers the exact aliases that experienced developers rely on (the ones that cut command length by 70% or more) and shows you how to set them up in under five minutes.

What Are Git Aliases and Why Bother?

Git aliases are custom shorthand commands stored in your Git configuration file. They turn verbose operations — like git checkout main — into something you can type in your sleep (git co main or just gcm if you're using shell aliases too).

The real value? Flow state. Every time you pause to remember a flag or type a long command, you break concentration. Aliases keep you in the zone. They're also portable — once configured, they work across VS Code, iTerm2, Windows Terminal, or whatever setup you're running.

How Do You Set Up Git Aliases?

You've got two options: edit your global .gitconfig file directly or use Git's command-line interface.

The CLI approach looks like this:

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status

Or open ~/.gitconfig and add them manually under an [alias] section. That's it — no plugins, no dependencies. The changes take effect immediately in every terminal window you've got open.

For the full syntax details, check the official Git documentation on aliases.

What Git Aliases Should You Add First?

Start with the commands you type most frequently. Here's the thing — most developers use maybe eight Git commands for 90% of their work. Aliasing those eight delivers the biggest payoff.

Command Alias What It Does
git checkout git co Switch branches
git checkout -b git cob Create and switch to new branch
git branch git br List branches
git commit -m git cm Commit with message
git status git st Check working tree status
git log --oneline --graph git lg Pretty log with graph
git push origin HEAD git po Push current branch
git pull --rebase git pr Pull with rebase

Power User Aliases Worth Stealing

Once you've got the basics down, these aliases solve specific pain points:

  • git undo — Soft reset of last commit (reset HEAD~1 --soft). The catch? It keeps your changes staged. Perfect for when you commit too early.
  • git amend — Quick amend without editing the message (commit --amend --no-edit).
  • git unstage — Remove files from staging area (reset HEAD --).
  • git last — Show the last commit (log -1 HEAD).

Worth noting: combine Git aliases with shell aliases for maximum speed. Many developers alias git itself to g — so git checkout main becomes g co main. That's 15 characters down to 7.

How Do You Sync Aliases Across Machines?

Store your .gitconfig in a dotfiles repository on GitHub or GitLab. Symlink it on each new machine. Some developers use tools like chezmoi or Dotbot to automate the setup — especially handy if you're juggling a MacBook Pro for work and a Dell XPS running Ubuntu for personal projects.

One more thing: don't overdo it. Aliases should be intuitive. If you can't remember what git xyz does three weeks later, it wasn't worth creating.