Setup Git Aliases
Add these to your ~/.gitconfig
:
txt
[alias]
# Quick status
s = status -s
# Pretty log
lg = log --graph --oneline --decorate --all
# Commit shortcuts
c = commit -m
ca = commit -am
# Branch management
b = branch
ba = branch -a
bd = branch -d
# Checkout shortcuts
co = checkout
cob = checkout -b
# Undo last commit (keep changes)
undo = reset HEAD~1 --soft
# Show last commit
last = log -1 HEAD --stat
# Amend last commit
amend = commit --amend --no-edit
# Pull with rebase
up = pull --rebase
# Show contributors
contributors = shortlog -sn
Usage Examples
bash
# Instead of: git status -s
git s
# Instead of: git commit -m "message"
git c "message"
# Instead of: git checkout -b feature
git cob feature
# Pretty log
git lg
# Undo last commit (keep changes)
git undo
Or Add via Command Line
bash
git config --global alias.s "status -s"
git config --global alias.lg "log --graph --oneline --decorate --all"
git config --global alias.c "commit -m"
Time saved: ~30 seconds per command ⚡