Von Gast (nicht überprüft) , 29 April 2026

Aliase, die Miete zahlen

Die ersten zehn Git-Aliase, nach denen jeder greift, decken die Grundlagen ab.

Logging

[alias]
    l = log --oneline --decorate -20
    ll = log --oneline --decorate --graph --all
    lg = log --graph --pretty=format:'%C(yellow)%h%Creset %C(cyan)%an%Creset %s %C(green)(%cr)%Creset %C(red)%d%Creset'
    recent = "log --pretty=format:'%C(yellow)%h%Creset %s %C(green)(%cr)%Creset' --date=relative -10"

Status und Diffing

[alias]
    s = status -sb
    d = diff
    dc = diff --cached
    dw = diff --word-diff
    ds = diff --stat
    df = "!git diff --color $@ | diff-so-fancy"

Branch-Management

[alias]
    br = branch
    brd = branch -d
    new = checkout -b
    sw = switch
    swc = switch -c
    recent-branches = "for-each-ref --count=10 --sort=-committerdate refs/heads/ --format='%(refname:short)'"
    gone = "!git fetch --prune && git branch -vv | awk '/: gone]/{print $1}' | xargs -r git branch -D"

Sync-Workflows

[alias]
    sync = "!git fetch --all --prune && git pull --rebase"
    update = "!git checkout main && git pull && git checkout - && git rebase main"
    publish = "!git push -u origin $(git symbolic-ref --short HEAD)"
    unpublish = "!git push origin --delete $(git symbolic-ref --short HEAD)"

Commit-Abkurzungen

[alias]
    amend = commit --amend --no-edit
    reword = commit --amend
    wip = "!git add -A && git commit -m 'WIP'"
    unwip = reset --soft HEAD~1
    save = "!f() { git add -A && git commit -m \"savepoint: ${1:-$(date)}\"; }; f"

Stash-Helfer

[alias]
    ss = stash save
    sp = stash pop
    sl = stash list
    sa = stash apply

Rebase-Helfer

[alias]
    rb = rebase
    rbi = rebase -i
    rbc = rebase --continue
    rba = rebase --abort
    rbs = rebase --skip
    fixup = "!f() { git commit --fixup $1; }; f"
    autosquash = "rebase -i --autosquash"

Historie-Erkundung

[alias]
    who = "shortlog -sn --no-merges"
    last = log -1 HEAD --stat
    find = "!f() { git log --all --pretty=format:'%h %s' --grep=\"$1\"; }; f"
    contains = "branch --contains"
    first = "log --reverse --pretty=format:'%h %s' -1"

Cleanup

[alias]
    cleanup = "!git fetch --prune && git branch --merged main | grep -v -E '^\\*|^\\s*(main|master|develop)$' | xargs -r git branch -d"
    nuke = "!git reset --hard HEAD && git clean -fd"
    prune-all = "!git fetch --all --prune && git gc --aggressive"