git/.gitconfig.includes/aliases.gitconfig

# git/.gitconfig.includes/aliases.gitconfig
# Included from .gitconfig via:
#   [include] path = ~/.gitconfig.includes/aliases.gitconfig

[alias]
    # Status / diff
    s      = status -sb
    d      = diff
    ds     = diff --staged
    dw     = diff --word-diff=color
    last   = log -1 HEAD --stat

    # Branches
    br     = branch --sort=-committerdate
    co     = switch
    cb     = switch -c
    bname  = rev-parse --abbrev-ref HEAD

    # Commits
    cm     = commit -v -m
    ca     = commit -v --amend
    can    = commit -v --amend --no-edit
    fixup  = commit --fixup

    # Log
    l      = log --graph --decorate --oneline -n 20
    lg     = log --graph --decorate --pretty=format:'%C(auto)%h %ad %s %C(bold blue)<%an>%C(reset)' --date=short
    today  = log --since=midnight --author='$(git config user.email)' --oneline

    # Rebase helpers
    rb     = rebase
    rbi    = rebase -i
    rbc    = rebase --continue
    rba    = rebase --abort
    absorb = "!git commit --fixup=HEAD && git rebase -i --autosquash HEAD~2"

    # Stash
    sl     = stash list
    sp     = stash pop
    sa     = stash apply

    # Worktree
    wa     = worktree add
    wl     = worktree list
    wr     = worktree remove

    # Root
    root   = rev-parse --show-toplevel

    # List untracked files with no noise
    ls-untracked = ls-files --others --exclude-standard

    # Amend: stage everything first, then amend.
    ame    = "!f() { git add -A && git commit --amend --no-edit; }; f"