Requires: difft (difftastic), installed via brew install difftastic.
Shell: zsh (these are shell functions, not git aliases — may work in bash but not in fish or sh)
| Command | Action | Notes | Examples |
|---|---|---|---|
gdl [-- <pathspec>] |
Show staged + unstaged changes vs HEAD. | • gdl — all current changes• gdl -- '*.ts' — filtered to .ts files• gdl -- src/ — directory |
|
gdlu [-- <pathspec>] |
Show unstaged changes. | • gdlu — all filepaths• gdlu -- '*auth*' — paths containing "auth"• gdlu -- src/ — directory |
|
gdls [-- <pathspec>] |
Show staged changes. | • gdls — all filepaths• gdls -- '*api*' — paths containing "api"• gdls -- lib/ — directory |
|
gdc [N|ref|range] [-- <pathspec>] |
Show commit(s). Smart dispatch by input type. | No arg = last commit. Number = last N. Range = diff across range. Ref = specific commit. | • gdc — last commit (HEAD)• gdc 3 — last 3 commits• gdc abc123 — specific commit• gdc HEAD~5..HEAD — range• gdc abc123 -- '*ts' — filtered |
gdb [target] [-s <source>] [-- <pathspec>] |
Diff 2 branches. Defaults to current vs master. | Shows only what your branch (source) changed — ignores new commits on master (target) since you branched off. This is git diff master...HEAD (merge-base). |
• gdb — current vs master• gdb develop -s feature-x• gdb -- '*auth*' — filtered |
Convention: [opt] = optional, <req> = required.
Many commands need hashes, like gdc <hash>, gdc <older>..<newer>, git cherry-pick <hash>, git cherry-pick <older>..<newer>, or git revert <hash>. The point of these commands is to help you find the commit and quickly copy its hash.
Workflow: run gl to find the commit number, q to exit, gl 3 to copy its
short hash, then use it by pasting it in another command.
macOS: pbcopy is used to copy so this will not work with other operating systems.
| Command | Action | Examples |
|---|---|---|
gl [N] [-- <pathspec>] |
git log with numbered commits |
• gl 3 — copy short hash of commit #3• gl -- package.json — log filtered to that file• gl 3 -- package.json — copy 3rd commit touching that file |
glo [N] [-- <pathspec>] |
git log --oneline with numbered commits |
• glo 5 — copy short hash of commit #5• glo -- '*.ts' — oneline filtered to .ts files• glo 5 -- '*.ts' — copy 5th .ts commit |
-- <pathspec>filters to commits touching those files — same as native git.
All commands support -- <pathspec> — same as
native git. A quick refresher:
- Literal (no wildcards) — exact path from repo root.
api.tsmatches only./api.ts. - fnmatch (has
*,?,[) —*crosses/.'*.ts'finds all.tsat any depth. - Anchored by default —
'*/api.ts'matchespages/api.tsbut NOTgrapi.ts(root level). - Unanchored substring — wrap in
*→'*api*'matches any path containing "api". - Never lead with
/—'/api.*'is treated as absolute path (fatal). - Quote patterns with
*,?,[to prevent shell expansion. - Multiple path patterns:
-- 'api.ts' '*/api.ts'— needed to match root + any depth; a single pattern won't cover both.
| Pathspec | Matches | Notes |
|---|---|---|
-- src/ |
All files under src/ recursively |
Directory prefix |
-- api.ts |
./api.ts only |
Literal — exact path from repo root |
-- '*.ts' |
foo.ts, src/bar.ts, a/b/baz.ts |
* crosses / — all .ts at any depth |
-- '*/api.ts' |
pages/api.ts, a/b/api.ts |
Anchored — filename exactly api.ts |
-- '*api*' |
pages/api/route.ts, useApi.ts, grapi.ts |
Unanchored — substring across full path |
-- 'api.ts' '*/api.ts' |
./api.ts, pages/api.ts, a/b/api.ts |
Multiple pathspecs — root + any depth |
glo # numbered one-line log, scroll with j/k
# note commit #3 looks interesting
q # exit less
glo 3 # copies abc1234 to clipboard
gdc abc1234 # structural diff of that commit
gdc 3 # or: structural diff of last 3 commits
gdb # what does this whole branch look like vs master?Run this single command — it fetches the latest, prepends a version header (hash + date), compares with the installed version, and reloads:
_GIST=https://gist.githubusercontent.com/Noitidart/de33f3e482349d88025940ffa22333b3 && \
_REPO=https://gist.github.com/de33f3e482349d88025940ffa22333b3.git && \
_REPO_ID=$(basename "$_REPO" .git) && \
_TARGET=~/my-zsh-commands/difftastic-git-shortcuts.zsh && \
_REMOTE_HASH=$(git ls-remote "$_REPO" refs/heads/main | cut -c1-7) && \
_REMOTE_DATE=$(gh api "gists/$_REPO_ID/commits?per_page=1" --jq '.[0].committed_at[:10]' 2>/dev/null) && \
curl -sS "$_GIST/raw/difftastic-git-shortcuts.zsh" -o "$_TARGET.tmp" && { echo "# $_REMOTE_HASH ${_REMOTE_DATE:-unknown date}"; echo; cat "$_TARGET.tmp"; } > "$_TARGET.tmp~" && mv "$_TARGET.tmp~" "$_TARGET.tmp" && \
_NEW=$(head -1 "$_TARGET.tmp") && _OLD=$(head -1 "$_TARGET" 2>/dev/null || true) && \
if [[ "$_NEW" = "$_OLD" ]]; then \
rm "$_TARGET.tmp" && echo "Already up to date"; \
else \
mkdir -p ~/my-zsh-commands && mv "$_TARGET.tmp" "$_TARGET" && \
if [[ -n "$_OLD" ]]; then \
_OD=$(echo "$_OLD" | cut -d' ' -f3) && _ND=$(echo "$_NEW" | cut -d' ' -f3) && echo "Updated $_OD → $_ND"; \
else \
echo "Installed ($(echo "$_NEW" | cut -d' ' -f3))"; \
fi && \
grep -q 'my-zsh-commands/difftastic-git-shortcuts.zsh' ~/.zshrc || echo 'source ~/my-zsh-commands/difftastic-git-shortcuts.zsh' >> ~/.zshrc && \
source ~/.zshrc; \
fiReports Already up to date, Updated 2026-05-02 → 2026-05-03,
or Installed (2026-05-03).
sed -i '' '/my-zsh-commands\/difftastic-git-shortcuts.zsh/d' ~/.zshrc && \
rm ~/my-zsh-commands/difftastic-git-shortcuts.zsh && \
source ~/.zshrc