Git Aliases Cheatsheet

by Kiki Cuyler March 12, 2026 Public
61 views Raw Download Revisions (v1)

Revision History

No revision history recorded yet.

.gitconfig_aliases bash Raw
[alias]
  # Short status
  st = status -sb

  # One-line log with graph
  lg = log --oneline --graph --decorate --all

  # Stage all changes
  aa = add --all

  # Amend without changing message
  fixup = commit --amend --no-edit

  # Undo last commit (keep changes staged)
  undo = reset --soft HEAD~1

  # Show branches sorted by recency
  recent = branch --sort=-committerdate --format='%(committerdate:short) %(refname:short)'

  # Stash with a message
  save = stash push -m

  # Delete merged local branches
  cleanup = "!git branch --merged | grep -v main | grep -v master | xargs git branch -d"

  # Show diff of staged changes
  staged = diff --cached
Skip to toolbar