git 📝 Code Snippet
Essential Git Aliases
Time-saving Git command shortcuts for daily development workflow
Language: bash • Beginner
• Updated: February 12, 2026
Speed up your Git workflow with these essential command aliases. Add them to your ~/.gitconfig file.
Setup
Add these to your .gitconfig file under the [alias] section:
[alias]
# Status and info
st = status
s = status -s
# Committing
ci = commit
cm = commit -m
ca = commit --amend
# Branching
co = checkout
cob = checkout -b
br = branch
# Viewing changes
df = diff
dfs = diff --staged
last = log -1 HEAD
# Logging
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
# Pulling and pushing
pl = pull
ps = push
psu = push -u origin HEAD
# Stashing
st = stash
stp = stash pop
stl = stash list
# Undoing
unstage = reset HEAD --
undo = reset --soft HEAD~1
Most Useful Aliases
git st- Quick status checkgit cm "message"- Fast commitsgit lg- Beautiful commit history graphgit cob feature-name- Create and switch to new branchgit psu- Push new branch to origin
Usage Examples
# Instead of: git status
git st
# Instead of: git commit -m "Fix bug"
git cm "Fix bug"
# Instead of: git checkout -b feature/new-feature
git cob feature/new-feature
# Instead of: git log --graph --pretty=format:...
git lg
These aliases will save you countless keystrokes and make your Git workflow much more efficient.