· Jonathan Cutrer · Engineering  · 4 min read

The Git Aliases I Actually Use Every Day

Not a comprehensive git config dump. Just the aliases that changed how fast I move through a normal workday.

Not a comprehensive git config dump. Just the aliases that changed how fast I move through a normal workday.

I’ve collected git aliases for years. Most of them I added once and never used. These are the ones that actually stuck — the ones I notice missing when I’m on a machine that doesn’t have my dotfiles.

The Core Config

[alias]
    # Status and log
    st = status -sb
    ll = log --oneline --graph --decorate --all -20
    lf = log --oneline --graph --decorate --all
    last = log -1 HEAD --stat

    # Staging
    ap = add -p
    unstage = reset HEAD --

    # Branch
    br = branch -vv
    brd = branch -d
    co = checkout
    cob = checkout -b
    sw = switch
    swc = switch -c

    # Commits
    cm = commit -m
    ca = commit --amend --no-edit
    wip = !git add -A && git commit -m 'wip'

    # Diffs
    d = diff
    dc = diff --cached
    ds = diff --stat

    # Remote
    f = fetch --all --prune
    pu = push -u origin HEAD
    puf = push --force-with-lease

    # Cleanup
    gone = !git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -d
    trim = !git fetch --prune && git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -d

The Ones That Matter Most

git ll — Log That’s Actually Readable

* a71ded1 (HEAD -> main) fix: bypass image optimizer for external URLs
* 4897650 content: add 10 diverse test blog posts
* 8234abc feat: infinite scroll JSON endpoint

--oneline --graph --decorate --all -20 limits to 20 commits with branch pointers visible and the graph showing divergence. I use this constantly. The -20 flag means it’s fast even on repos with long histories.

git lf is the same without the -20 — when I need to scroll back further.

git ap — Patch-Mode Staging

Interactive staging is the most underused git feature. git add -p walks you through every change hunk and asks: stage this? skip? split smaller?

git ap
diff --git a/src/pages/index.astro b/src/pages/index.astro
@@ -44,7 +44,7 @@ const recentWork = [
-      href: getPermalink('/portfolio'),
+      href: getPermalink('/work'),

Stage this hunk [y,n,q,a,d,s,?]?

It makes you read your own diff before committing. I commit fewer typos and fewer accidental debug lines because of this.

git wip — Save Where You Are

git add -A && git commit -m 'wip' is the thing I push when I have to switch context immediately and don’t want to stash. On a personal or feature branch this is fine. The commit exists, it’s recoverable, and I can squash it later with git ca (amend) or an interactive rebase.

git gone — Clean Up Dead Branches

After a PR merges and the remote branch is deleted, the local tracking branch sticks around. git gone finds branches whose remote is marked [gone] in git branch -vv and deletes them.

git gone
Deleted branch feature/add-infinite-scroll (was 8234abc).
Deleted branch fix/unsplash-image-404 (was a71ded1).

Run this once a week and your git branch output stays readable.

git puf — Force Push Safely

push --force-with-lease is force push with a check: it only succeeds if your local ref matches the remote. If someone else pushed to the branch since you last fetched, it fails rather than overwriting their work. I use this instead of --force exclusively.

git pu — Push and Set Upstream

push -u origin HEAD pushes the current branch and sets it to track the remote. I use this on every first push of a new branch. No more “fatal: The current branch has no upstream branch.”

On Amending

git ca (commit —amend —no-edit) modifies the last commit without changing the message. Useful for the second before you push when you realize you forgot to stage one file.

Never amend a commit that’s been pushed. The alias doesn’t enforce that — you have to enforce it yourself.

Adding to Your Config

git config --global alias.ll "log --oneline --graph --decorate --all -20"

Or edit ~/.gitconfig directly. The [alias] section is just a flat key-value block. The ! prefix in gone and trim runs the value as a shell command rather than a git subcommand.

What I Don’t Alias

Interactive rebase (git rebase -i). The flags matter too much to abbreviate, and the few seconds I spend typing them are useful friction that makes me think about what I’m about to do to the commit history.

git reset --hard. I want that to be slightly annoying to type.

Back to Blog

Related Posts

View All Posts »
The Tools I Actually Use in 2026

The Tools I Actually Use in 2026

Not a gear list for the algorithm. Just the software and setup I actually reach for every day — with honest notes on what I'd change.