Originally published on 2012-04-11; fully revised and updated.
If you run Git commands all day, short Bash aliases can remove repetitive typing and speed up routine actions like status checks, staging, commits, and pushes. This guide gives you a corrected alias set for ~/.bashrc, explains how it differs from Git-native aliases, and shows a safe workflow for adding and validating aliases.

What these aliases are (and are not)
The original post lists Bash aliases, not Git configuration aliases. That means they are interpreted by your shell and typically stored in ~/.bashrc (or another shell startup file).
Important correction: in Bash, alias syntax should not include spaces around =. For example, use alias g='git status', not alias g = "git status".
Bash aliases vs Git aliases
| Option | Defined in | How you run it | Best for |
|---|---|---|---|
| Bash alias | Shell config (for example ~/.bashrc) | g, ga, gps | Very short commands in interactive shell sessions |
| Git alias | Git config (for example ~/.gitconfig) | git st, git co | Git-specific shortcuts that travel with Git config |
Drop-in Bash alias set for common Git commands
This is a corrected version of the original alias collection, ready to paste into ~/.bashrc.
alias g='git status'
alias ga='git add'
alias gaa='git add .'
alias gc='git commit -m'
alias gca='git commit -am'
alias gb='git branch'
alias gbd='git branch -d'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gm='git merge'
alias gr='git rebase'
alias gl='git log'
alias gs='git show'
alias gd='git diff'
alias gbl='git blame'
alias gps='git push'
alias gpl='git pull'Code language: JavaScript (javascript)
Install and reload safely
- Back up your current Bash config before editing.
- Add the aliases to
~/.bashrc. - Reload your shell configuration.
- Run a quick smoke test.
cp ~/.bashrc ~/.bashrc.bak.$(date +%Y%m%d)
# Edit ~/.bashrc in your preferred editor, then reload:
source ~/.bashrc
# Quick checks:
type g
type ga
gCode language: PHP (php)
Daily Git workflow with aliases
flowchart TD
A[Edit files] --> B[Run g for status]
B --> C[Stage with ga or gaa]
C --> D[Commit with gc message]
D --> E[Push with gps]
E --> F[Sync with team]
Alias reference
| Alias | Expands to | Typical use |
|---|---|---|
g | git status | Check current repo state |
ga | git add | Stage specific files |
gaa | git add . | Stage all changes in current directory tree |
gc | git commit -m | Create commit with inline message |
gca | git commit -am | Commit tracked-file changes quickly |
gb | git branch | List/manage branches |
gbd | git branch -d | Delete merged branch |
gco | git checkout | Switch branch or restore path behavior via checkout |
gcob | git checkout -b | Create and switch to new branch |
gm | git merge | Merge branch history |
gr | git rebase | Rebase local work |
gl | git log | Inspect commit history |
gs | git show | Show commit details |
gd | git diff | Inspect unstaged or staged changes (with options) |
gbl | git blame | Trace line-level authorship |
gps | git push | Push branch to remote |
gpl | git pull | Fetch and integrate remote changes |
If you prefer Git-native aliases
Git-native aliases are configured in Git instead of Bash. They are invoked as git <alias>.
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commitCode language: CSS (css)
Common pitfalls and best practices
- Do not use spaces around
=in Bash alias definitions. - Remember that
gca(git commit -am) does not include new untracked files. - Quote commit messages when using
gc, for example:gc "fix login timeout". - Keep a backup of
~/.bashrcbefore bulk edits. - For teams, document your alias set so onboarding is consistent.
Note: the original page also contained a YouTube gallery embed that currently reports an API key restriction error. Direct link preserved from the source: https://www.youtube.com/watch?v=ZCfrNvu6nMc.
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals