bashbeginner
Git Aliases for Productivity
Essential git aliases and config settings to speed up daily git workflow and reduce typing.
bashPress ⌘/Ctrl + Shift + C to copy
# Set up useful aliases
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'
git config --global alias.lg 'log --oneline --graph --all --decorate'
git config --global alias.amend 'commit --amend --no-edit'
git config --global alias.undo 'reset --soft HEAD~1'
git config --global alias.wip 'stash save "WIP"'
git config --global alias.unwip 'stash pop'
git config --global alias.branches 'branch -a --sort=-committerdate'
git config --global alias.who 'shortlog -sn --no-merges'
git config --global alias.cleanup 'branch --merged | grep -v main | xargs git branch -d'
# Useful config settings
git config --global pull.rebase true
git config --global push.autoSetupRemote true
git config --global fetch.prune true
git config --global init.defaultBranch main
git config --global rerere.enabled true
git config --global diff.algorithm histogram
git config --global merge.conflictstyle zdiff3
# View all aliases
git config --global --get-regexp alias
# Or directly edit gitconfig
# git config --global --editUse Cases
- Speeding up daily git workflow
- Standardizing git config across team
- Reducing typing for frequent commands
Tags
Related Snippets
Similar patterns you can reuse in the same workflow.
bashbeginner
Git Config — Essential Global Settings
Configure Git globally with aliases, default branch, editor, credentials, and performance settings.
Best for: Setting up Git on a new machine
#git#config
bashadvanced
Git Worktree for Multiple Branches
Work on multiple branches simultaneously using git worktree without stashing or switching.
Best for: Reviewing PRs while working on a feature
#git#worktree
bashbeginner
Git Stash — Named, Partial, and Pop Strategies
Advanced stash techniques: named stashes, partial stash, stash apply vs pop, and branch from stash.
Best for: Saving work in progress before switching branches
#git#stash
bashintermediate
Git Blame — Ignore Formatting Commits
Configure git blame to skip formatting-only commits using .git-blame-ignore-revs for cleaner history.
Best for: Ignoring bulk formatting commits in blame output
#git#blame