Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Bash Git Aliases: A Practical Command Set for Faster Daily Git Work

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.

Bash aliases for Git

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

OptionDefined inHow you run itBest for
Bash aliasShell config (for example ~/.bashrc)g, ga, gpsVery short commands in interactive shell sessions
Git aliasGit config (for example ~/.gitconfig)git st, git coGit-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

AliasExpands toTypical use
ggit statusCheck current repo state
gagit addStage specific files
gaagit add .Stage all changes in current directory tree
gcgit commit -mCreate commit with inline message
gcagit commit -amCommit tracked-file changes quickly
gbgit branchList/manage branches
gbdgit branch -dDelete merged branch
gcogit checkoutSwitch branch or restore path behavior via checkout
gcobgit checkout -bCreate and switch to new branch
gmgit mergeMerge branch history
grgit rebaseRebase local work
glgit logInspect commit history
gsgit showShow commit details
gdgit diffInspect unstaged or staged changes (with options)
gblgit blameTrace line-level authorship
gpsgit pushPush branch to remote
gplgit pullFetch 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 ~/.bashrc before 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.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
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.

Related Posts

Online Git Repository Hosting: Revisiting the 2014 Top 10 with a Modern Selection and Migration Guide

This revised guide preserves the original 2014 list of Git hosting websites and adds a practical framework for evaluating providers today. It also includes a selection workflow and Git commands for safe repository migration.

Read More

Git Troubleshooting for Slow or Hanging Commands: Tracing, Verbose Logs, and Safer Diagnostics

When Git push or clone appears stuck, built-in trace flags can quickly reveal where execution is failing. This guide gives a practical workflow, command patterns, and common pitfalls for collecting actionable Git diagnostics.

Read More

Gitflow Branching Model: Practical Guide to Feature, Release, and Hotfix Branches

Learn how the classic Gitflow model organizes development with long-lived and short-lived branches. This guide covers branch rules, workflow, and production-ready Git command examples.

Read More

What is Git and use cases of Git?

What is Git? Git is a distributed version control system (DVCS) planned to track changes in source code during software development. It was developed by Linus Torvalds…

Read More

What is GitOps?

GitOps is a modern approach to managing and automating the deployment and operation of applications and infrastructure using Git as the single source of truth. In GitOps,…

Read More

What is Git LFS and use cases of Git LFS?

What is Git LFS? Git LFS (Large File Storage) is an extension of the Git version control system that addresses the challenge of managing large files and…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x