Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. Download free →
CLSkills
Git & Version Controlbeginner

Git Alias Setup

Share

Configure useful git aliases for common workflows

Works with OpenClaude

You 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 --list to see existing aliases and global config
  • Check ~/.gitconfig file to see current alias definitions
  • Verify git version with git --version (aliases work on all modern versions)

Steps

  1. Open your global git config file with git config --global --edit (opens in your default editor) or directly edit ~/.gitconfig
  2. Add a [alias] section if it doesn't exist, or append to the existing one
  3. Create short aliases for frequently used commands: st for status, co for checkout, br for branch, ci for commit
  4. Add compound aliases for multi-step workflows: unstage to undo staging, last to show last commit, amend for quick fixes
  5. Create helpful viewing aliases: log customizations for better commit history display, diff for staged changes
  6. Test each alias by running it — for example, git st should equal git status
  7. For team consistency, add aliases to a shared .gitconfig file in your repository root and document them in your README
  8. 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 co to checkout and try to alias something using co, it won't expand the nested alias
  • Aliases set with --global apply 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

Quick Info

Difficultybeginner
Version1.0.0
AuthorClaude Skills Hub
gitaliasesproductivity

Install command:

curl -o ~/.claude/skills/git-alias-setup.md https://claude-skills-hub.vercel.app/skills/git/git-alias-setup.md

Related Git & Version Control Skills

Other Claude Code skills in the same category — free to download.

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.