Skip to content

Instantly share code, notes, and snippets.

@dylarcher
Last active February 18, 2026 12:56
Show Gist options
  • Select an option

  • Save dylarcher/5ca71ed0a3b5d107bbcdc64e9a21a650 to your computer and use it in GitHub Desktop.

Select an option

Save dylarcher/5ca71ed0a3b5d107bbcdc64e9a21a650 to your computer and use it in GitHub Desktop.
custom git aliases

Alias Appendix

Quick reference for all custom git aliases configured in this workspace.

SYSTEM ALIASES

bash|zsh compatible (shell)

TRAVERSE/Nav: FS

alias ....='cd ../../..'
alias ...='cd ../..'
alias ..='cd ..'

HISTORY/Task: Diff

alias jobs='jobs -l'
alias hist='history'

UPDATES/Vers: Deps

alias updep='bun update -g --latest'
alias uplib='brew update --force'
alias uppkg='brew upgrade --force'
alias upall='uplib && uppkg && updep && source ~/.zshrc'

CACHING/Clean: Refs

alias xbrew='brew cleanup --prune=all'
alias xbun='bun pm cache rm'
alias xdeps='rm -rf node_modules/.cache'
alias xlock='rm -rf *-lock.* *.lock*'
alias xnode='rm -rf ~/.npm/_npx && rm -rf ~/.node-gyp'
alias xnpm='npm cache clean --force'
alias xpnpm='pnpm store prune'
alias xpmcache='xnpm && xpnpm && xbun'
alias xrtcache='xbrew && xnode && xdeps && xlock'
alias xpkgcache='xpmcache && xrtcache'

ECOSYSTEM/Env: WS

alias updeps='pnpm update -r'
alias updeps-latest='pnpm update -rL'

Branch/Nav

⎈ ALIAS
keywordshortcutterm
⌘ COMMAND
cmdexecutesoperationscriptsequencetask
¶ DESCRIPTION
briefinfointentpurposerationalesummary
current branch --show-current Print the current branch name
del branch --delete --force Force-delete a local branch
delgone fetch -p && branch -vv | … Delete local branches whose remote is gone
delmrgd branch --merged | … Delete local branches already merged into main
delpr gh pr list --state merged … Delete local branches for your merged PRs
delsame branch --list "*pattern*" | … Delete all local branches matching a pattern
extend switch --create <branch>-extend Create an -extend branch off the current one
new switch --create Create and switch to a new branch
prev switch - Switch to the previously checked-out branch
recent for-each-ref --sort=-committerdate … List the 10 most recently committed-to branches
root rev-parse --show-toplevel Print the repository root path
swap switch Shorthand for git switch
wip switch --create <branch>-wip-<timestamp> Create a timestamped WIP branch

Stage/Commit

⎈ ALIAS
keywordshortcutterm
⌘ COMMAND
cmdexecutesoperationscriptsequencetask
¶ DESCRIPTION
briefinfointentpurposerationalesummary
amend commit --amend --no-edit Amend the last commit without editing the message
amendall add . && amend && push --force-with-lease Stage all, amend, and force-push
fixup commit --fixup=<ref> Create a fixup commit targeting a specific ref
save stash push -m "<branch>-<timestamp>" Stash changes with an auto-generated label
staged diff --cached Show staged changes
unstage reset HEAD -- Unstage files from the index
untracked ls-files --others --exclude-standard List untracked files

Diff/History

⎈ ALIAS
keywordshortcutterm
⌘ COMMAND
cmdexecutesoperationscriptsequencetask
¶ DESCRIPTION
briefinfointentpurposerationalesummary
changed diff --name-only origin/HEAD...HEAD List files changed vs the default branch
changes log --oneline origin/HEAD..HEAD Show commits ahead of the default branch
history log --oneline --decorate --graph -20 Pretty-print the last 20 commits as a graph
last log -1 HEAD --stat Show the last commit with file stats
recap log --oneline --stat -10 Show the last 10 commits with file stats
today log --author=<you> --since=midnight --oneline Your commits from today
tree log --oneline --decorate --graph --all CMD/commit graph across all branches
wdiff diff --word-diff Word-level diff
week log --author=<you> --since='1 week ago' --oneline Your commits from the past week

Stash/Store

⎈ ALIAS
keywordshortcutterm
⌘ COMMAND
cmdexecutesoperationscriptsequencetask
¶ DESCRIPTION
briefinfointentpurposerationalesummary
lsstash stash show -p Show the contents of the latest stash
stashes stash list List all stashes
stashpick stash list | fzf | … stash apply Interactively pick and apply a stash via fzf

Merge/Rebase

⎈ ALIAS
keywordshortcutterm
⌘ COMMAND
cmdexecutesoperationscriptsequencetask
¶ DESCRIPTION
briefinfointentpurposerationalesummary
abort merge --abort || cherry-pick --abort || rebase --abort Abort whichever in-progress operation is active
cp cherry-pick Shorthand for git cherry-pick
rba rebase --abort Abort a rebase
rbc rebase --continue Continue a rebase
rbi rebase --interactive Start an interactive rebase
squish reset --soft $(merge-base HEAD @{upstream}) Soft-reset all commits back to the upstream fork point
recommit fetch && reset --soft merge-base && merge --no-commit Re-stage all branch work as uncommitted changes

Sync/Align (w/remote)

⎈ ALIAS
keywordshortcutterm
⌘ COMMAND
cmdexecutesoperationscriptsequencetask
¶ DESCRIPTION
briefinfointentpurposerationalesummary
fresh fetch && reset --hard origin/HEAD && push --force-with-lease Hard-reset to the default branch and force-push
latest fetch --all --prune && pull Fetch everything and pull
nuke reset --hard && clean -fd Discard all changes and untracked files
pushup push --set-upstream origin <current> Push and set upstream for the current branch
reindex sync && reset --hard origin/HEAD Sync the fork and hard-reset to the default branch
remotes remote -v List all remotes
sync gh repo sync && pull --all --prune Sync the fork via GitHub CLI, then pull
undo reset --soft HEAD~1 Undo the last commit, keeping changes staged

Checks/Code Quality

⎈ ALIAS
keywordshortcutterm
⌘ COMMAND
cmdexecutesoperationscriptsequencetask
¶ DESCRIPTION
briefinfointentpurposerationalesummary
check tsc && lint --check && tidy --check Run type-check, lint, and format checks
lint diff …changed files… | biome check / eslint Lint changed JS/TS files (Biome preferred, ESLint fallback)
tidy diff …changed files… | prettier Format changed files with Prettier
tsc diff …changed .ts/.tsx… | tsc --noEmit Type-check changed TypeScript files
test diff …changed dirs… | pnpm --filter Run tests for changed packages

Status/Utils: gh (CLI)

⎈ ALIAS
keywordshortcutterm
⌘ COMMAND
cmdexecutesoperationscriptsequencetask
¶ DESCRIPTION
briefinfointentpurposerationalesummary
browse gh repo view --web Open the repo in the browser
ci gh run list --limit 5 Show the last 5 CI runs
ciwatch gh run watch Live-watch a CI run
draft gh pr create --fill --draft Create a draft PR with auto-filled details
issue gh issue create Create a new issue
issues gh issue list --assignee @me List issues assigned to you
issueview gh issue view --web Open an issue in the browser
merge gh pr merge --squash --delete-branch Squash-merge a PR and delete the branch
pr gh pr create --fill Create a PR with auto-filled details
prout gh pr checkout Check out a PR locally
prs gh pr list --author @me List your open PRs
prstatus gh pr status Show PR status for the current branch
prview gh pr view --web Open a PR in the browser
review gh pr edit --add-reviewer Add a reviewer to the current PR

Conf/Tools

⎈ ALIAS
keywordshortcutterm
⌘ COMMAND
cmdexecutesoperationscriptsequencetask
¶ DESCRIPTION
briefinfointentpurposerationalesummary
aliases config --get-regexp '^alias.' | … List all git aliases, sorted
conf config --list | grep -v alias | sort List non-alias git config entries
contributors shortlog --summary --numbered --no-merges List contributors ranked by commit count
dv difftool Open the configured difftool
edit config --global --edit Open the global git config in your editor
pnpmver corepack prepare pnpm@<ver> --activate Activate the pnpm version declared in package.json
state status --short --branch Compact status with branch info
tags tag --list --sort=-version:refname List tags sorted by semantic version (newest first)
usepnpm corepack prepare pnpm@<ver> --activate Activate a specific (or latest) pnpm version
#! /bin/sh
# global git configuration presets for all local repository branches
[init]
defaultBranch = main
[user]
email = dylarcher@gmail.com
name = Dylan Archer
[core]
autocrlf = input
editor = code --wait
ignorecase = false
pager = less -FRX
[credential]
helper = osxkeychain
[pull]
rebase = true
[push]
autoSetupRemote = true
[fetch]
all = true
prune = true
pruneTags = true
[branch]
sort = -committerdate
[commit]
verbose = true # show diff in commit message editor
[tag]
sort = -version:refname
[transfer]
fsckObjects = true # validate object integrity on push/fetch
[diff]
algorithm = histogram # better than default Myers algorithm
colorMoved = zebra
tool = vscode
[difftool "vscode"]
cmd = code --wait --diff $LOCAL $REMOTE
[merge]
conflictstyle = zdiff3. # 3-way conflict markers with common ancestor
tool = vscode
[mergetool "vscode"]
cmd = code --wait $MERGED
[filter "lfs"]
clean = git-lfs clean -- %f
process = git-lfs filter-process
required = true
smudge = git-lfs smudge -- %f
[rerere]
autoupdate = true
enabled = true
[column]
ui = auto
[rebase]
autoStash = true
autoSquash = true
updateRefs = true
[status]
branch = true
short = true
[log]
abbrevCommit = true
date = relative
[alias] #? <https://gist.github.com/dylarcher/5ca71ed0a3b5d107bbcdc64e9a21a650#file-aliases-md> (alias usage defs)
abort = "!git merge --abort 2>/dev/null || git cherry-pick --abort 2>/dev/null || git rebase --abort 2>/dev/null"
aliases = "!git config --get-regexp '^alias\\.' | sed 's/alias\\.\\([^ ]*\\) /\\1 = /' | sort"
amend = commit --amend --no-edit
amendall = "!git add . && git amend && git push --force-with-lease"
browse = "!gh repo view --web"
changed = "!git diff --name-only $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@refs/remotes/@@')...HEAD"
changes = "!git log --oneline $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@refs/remotes/@@')..HEAD"
check = "!git tsc && git judilint --check && git juditidy --check"
ci = "!gh run list --limit 5"
ciwatch = "!gh run watch"
conf = "!git config --list | grep -v '^alias\\.' | sort"
contributors = shortlog --summary --numbered --no-merges
cp = cherry-pick
current = branch --show-current
del = branch --delete --force
delgone = "!git fetch -p && git branch -vv | grep ': gone]' | awk '{print $1}' | xargs -r git branch -D"
delmrgd = "!git branch --merged | grep -vE '(main|master|develop|\\*)' | xargs -r git branch -d"
delpr = "!gh pr list --state merged --author @me --json headRefName -q '.[].headRefName' | xargs -r -I{} git branch -D {}"
delsame = "!f() { git branch --list \"*${1}*\" | xargs -r git branch -D; }; f"
draft = "!gh pr create --fill --draft"
dv = difftool
edit = config --global --edit
extend = "!git switch --create $(git branch --show-current)-extend"
fixup = "!f() { git commit --fixup=${1}; }; f"
fresh = "!f() { \
b=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@refs/remotes/@@'); \
git fetch origin && git reset --hard $b && git push --force-with-lease; \
}; f"
history = log --oneline --decorate --graph -20
issue = "!gh issue create"
issues = "!gh issue list --assignee @me"
issueview = "!gh issue view --web"
last = log -1 HEAD --stat
latest = "!git fetch --all --prune && git pull"
judilint = "!f() { \
b=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@refs/remotes/@@'); \
files=$(git diff --name-only --diff-filter=ACMR $b...HEAD | grep -E '\\.(js|ts|jsx|tsx)$'); \
[ -z \"$files\" ] && exit 0; if command -v biome &>/dev/null; \
then echo \"$files\" | xargs biome check ${@:---write}; \
else echo \"$files\" | xargs npx eslint ${@:---fix}; \
fi; \
}; f"
juditidy = "!f() { \
b=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@refs/remotes/@@'); \
files=$(git diff --name-only --diff-filter=ACMR $b...HEAD | grep -E '\\.(js|ts|jsx|tsx|json|css|md)$'); \
[ -z \"$files\" ] && exit 0; if command -v biome &>/dev/null; \
then echo \"$files\" | xargs biome format ${@:---write}; \
else echo \"$files\" | xargs npx prettier ${@:---write}; \
fi; \
}; f"
lsstash = stash show -p
merge = "!gh pr merge --squash --delete-branch"
new = switch --create
nuke = "!git reset --hard && git clean -fd"
pnpmver = "!f() { \
ver=$(perl -ne 'print $1 if /pnpm.*?([0-9]+[.][0-9.]+)/' package.json 2>/dev/null || echo 'latest'); \
corepack prepare pnpm@$ver --activate; \
}; f"
pr = "!gh pr create --fill"
prev = switch -
prout = "!gh pr checkout"
prs = "!gh pr list --author @me"
prstatus = "!gh pr status"
prview = "!gh pr view --web"
rba = rebase --abort
rbc = rebase --continue
rbi = rebase --interactive
recap = log --oneline --stat -10
recent = for-each-ref --sort=-committerdate --format='%(committerdate:relative)\t%(refname:short)' refs/heads/ --count=10
recommit = "!f() { \
b=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@refs/remotes/@@'); \
git fetch origin && git reset --soft $(git merge-base HEAD $b) && git merge $b --no-commit; \
}; f"
reindex = "!git sync && git reset --hard $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@refs/remotes/@@')"
remotes = remote -v
review = "!gh pr edit --add-reviewer"
root = rev-parse --show-toplevel
save = "!f() { git stash push -m \"${1:-$(git branch --show-current)-$(date +%Y%m%d-%H%M%S)}\"; }; f"
squish = "!git reset --soft $(git merge-base HEAD @{upstream})"
staged = diff --cached
stashes = stash list
stashpick = "!git stash list | fzf | cut -d: -f1 | xargs git stash apply"
state = status --short --branch
swap = switch
sync = "!gh repo sync && git pull --all --prune"
tags = tag --list --sort=-version:refname
juditest = "!f() { \
b=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@refs/remotes/@@'); \
git diff --name-only --diff-filter=ACMR $b...HEAD | cut -d/ -f1-2 | sort -u | xargs -r -I{} pnpm --filter {} test; \
}; f"
juditidy = "!f() { \
b=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@refs/remotes/@@'); \
git diff --name-only --diff-filter=ACMR $b...HEAD | grep -E '\\.(js|ts|jsx|tsx|json|css|md)$' | xargs -r npx prettier ${@:---write}; \
}; f"
today = "!git log --author=$(git config user.email) --since=midnight --oneline"
tree = log --oneline --decorate --graph --all
tsc = "!npx tsc --noEmit --skipLibCheck"
undo = reset --soft HEAD~1
unstage = reset HEAD --
untracked = ls-files --others --exclude-standard
usepnpm = "!f() { corepack prepare pnpm@${1:-latest} --activate; }; f"
wdiff = diff --word-diff
week = "!git log --author=$(git config user.email) --since='1 week ago' --oneline"
wip = "!git switch --create $(git branch --show-current)-wip-$(date +%Y%m%d-%H%M)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment