Git Aliases Reference
Git Aliases Reference
Section titled “Git Aliases Reference”Git aliases provide shortcuts for common operations. Run scripts/setup-git-aliases.sh to install all aliases automatically.
Core Workflow Aliases
Section titled “Core Workflow Aliases”git co <branch>- Checkout a branchgit cob <branch>- Create and checkout new branch (checkout -b)git kick "message"- Create empty commit (commit --allow-empty -m)git up- Fetch and rebase against origin/maingit refresh-main- Reset local main branch to match origin/main (creates temp branch if on main, deletes local main, checks out origin/main, cleans up)git st- Statusgit br- List branchesgit cm "message"- Commit with message (commit -m)git ca- Amend last commit (commit --amend)git cane- Amend without editing message (commit --amend --no-edit)git unstage- Unstage files (reset HEAD --)git undo- Undo last commit, keep changes (reset --soft HEAD^)
Log and History Aliases
Section titled “Log and History Aliases”git last- Show last commit (log -1 HEAD)git lg- Pretty log graph (log --oneline --decorate --graph --all)git ll- Last 10 commits (log --oneline --decorate -10)git recent- Show reflog
Diff Aliases
Section titled “Diff Aliases”git diffc- Show staged changes (diff --cached)git diffst- Show staged changes (alternative:diff --staged)git who- Show blame (blame)
Branch Management Aliases
Section titled “Branch Management Aliases”git branches- List all branches (branch -a)git ls- List most recently edited branches in reverse chronological order (branch --sort=-committerdate)git brm- Delete branches that are gone from remotegit cleanup- Clean up remote-tracking branches
Pull/Push Aliases
Section titled “Pull/Push Aliases”git pullr- Pull with rebase (pull --rebase)git pushf- Push with force-lease (push --force-with-lease)git pushu- Push and set upstream (push -u origin HEAD)
Feature Branch Helpers
Section titled “Feature Branch Helpers”git feat <name>- Create feature branch (feature/<name>)git fix <name>- Create fix branch (fix/<name>)git hotfix <name>- Create hotfix branch (hotfix/<name>)
Stash Aliases
Section titled “Stash Aliases”git stashlist- List stashes (stash list)git stashpop- Pop latest stash (stash pop)git stashapply- Apply latest stash (stash apply)
Convenience Aliases
Section titled “Convenience Aliases”git aliases- List all configured aliasesgit amend- Amend last commit without editing (commit --amend --no-edit)git save- Stage all and commit with “WIP” messagegit wip- Stage all and commit with “WIP” message
Automatic Setup
Section titled “Automatic Setup”To automatically configure all aliases, run:
# From standards repository./scripts/setup-git-aliases.sh
# Or as part of project setup./.standards/scripts/setup-git-aliases.shThe setup script will:
- Check for existing aliases and prompt before overwriting
- Configure all recommended aliases
- Provide feedback on what was configured
Manual Configuration
Section titled “Manual Configuration”If you prefer to configure aliases manually:
# Core aliasesgit config --global alias.st statusgit config --global alias.co checkoutgit config --global alias.cob 'checkout -b'git config --global alias.kick 'commit --allow-empty -m'git config --global alias.up '!git fetch origin && git rebase origin/main'
# View all aliasesgit config --global --get-regexp alias