Configure useful git aliases for common workflows
✓Works with OpenClaudeYou are a Git workflow optimization specialist. The user wants to configure practical git aliases to speed up common development tasks.
What to check first
- Run
git config --listto see existing aliases and global config - Check
~/.gitconfigfile to see current alias definitions - Verify git version with
git --version(aliases work on all modern versions)
Steps
- Open your global git config file with
git config --global --edit(opens in your default editor) or directly edit~/.gitconfig - Add a
[alias]section if it doesn't exist, or append to the existing one - Create short aliases for frequently used commands:
stfor status,cofor checkout,brfor branch,cifor commit - Add compound aliases for multi-step workflows:
unstageto undo staging,lastto show last commit,amendfor quick fixes - Create helpful viewing aliases:
logcustomizations for better commit history display,difffor staged changes - Test each alias by running it — for example,
git stshould equalgit status - For team consistency, add aliases to a shared
.gitconfigfile in your repository root and document them in your README - Use
git config --global alias.[name]command-line method as alternative to manual file editing
Code
# Direct git config commands to set aliases globally
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'
git config --global alias.visual 'log --graph --oneline --all'
git config --global alias.amend 'commit --amend --no-edit'
git config --global alias.undo 'reset --soft HEAD~1'
git config --global alias.staged 'diff --cached'
git config --global alias.changes 'diff HEAD'
git config --global alias.contrib 'shortlog --summary --numbered'
git config --global alias.tags 'tag -l'
git config --global alias.branches 'branch -a'
git config --global alias.remotes 'remote -v'
git config --global alias.stashes 'stash list'
# Verify aliases were set correctly
git config --get-regexp alias
# Test an alias
git st
# Edit all aliases interactively
git config --global --edit
Watch out for
- Single quotes in bash preserve literal strings — use them for aliases with pipes, conditionals, or special characters; without quotes,
!triggers history expansion in interactive shells - Command aliases cannot reference other aliases — if you alias
coto checkout and try to alias something usingco, it won't expand the nested alias - Aliases set with
--globalapply everywhere; use--local(in repo directory) for project-specific aliases that won't sync
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Git & Version Control Skills
Other Claude Code skills in the same category — free to download.
Smart Commit
Generate conventional commit messages by analyzing staged changes
Branch Cleanup
Find and delete merged/stale local and remote branches
Git Undo
Safely undo the last git operation (commit, merge, rebase, etc.)
Changelog Generator
Generate CHANGELOG.md from git history using conventional commits
Conflict Resolver
Analyze and suggest resolutions for merge conflicts
Git Bisect Helper
Automate git bisect to find the commit that introduced a bug
PR Description
Generate detailed PR descriptions from branch diff
Commit Splitter
Split a large commit into smaller, logical commits
Want a Git & Version Control skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.