git-whistles
Helpers for classic Git workflows. Written in Rust.
Install
macOS and Linux. Restart your shell afterwards.
curl --proto '=https' --tlsv1.2 -fsSL https://raw.githubusercontent.com/mezis/git-whistles/master/install.sh | bashThat builds git-whistles from source, puts git-<command> shims on your PATH, and defines:
alias wt='eval "$(git-whistles worktree-list)"'Running it again is safe. When brew is available it installs the published release with Homebrew (Linux x86_64, Linux arm64, and macOS Apple Silicon). Otherwise it installs Rust if needed (Homebrew, or rustup) and runs cargo install.
Manual build
cargo install --path . --locked
git-whistles shim --dir ~/.local/binshim and unshim are not shimmed; run them as git-whistles shim / git-whistles unshim. Remove shims with git-whistles unshim --dir ~/.local/bin.
Debugging
Pass -x or --echo-commands on any invocation (before or after the subcommand) to print each external command to stderr before it runs, similar to set -x.
Pass -v or --stream-commands to stream subprocess output to your terminal when git-whistles is not capturing that output for parsing (for commands that only capture stdout, stderr is still streamed).
git-whistles -x chop my-branch
git staging -x
git-changes -vCommands
-
git chop [branch1 ...]— Delete local and remote branch(es). If you're on a branch being chopped, checks out the primary branch (main/master) first. -
git ff-all-branches [--no-fetch] [-p] [--progress] [-q] [-r REMOTE]— Fast-forward all local tracking branches to their remote counterpart where possible. Fetches first by default;--no-fetchskips that step;-pdry-run;--progressprints a line for each branch that is or would be updated. Global-v/--stream-commandsstreams underlyinggitsubprocess output (see Debugging). -
git list-branches [-l] [-r] [-i integration-branch] [-p]— List local or remote branches and their distance to an integration branch (default: same primary asgit changes:origin/HEADif set, elseorigin/mainororigin/master).-pporcelain (CSV). -
git worktree-list/wt— Interactive table of worktrees from every main clone this command has been run in (repo, branch, path; long paths elide the prefix). Arrow keys move; typing letters/digits filters (subsequence match). Enter printscd -- 'path'(wtiseval "$(git-whistles worktree-list)"; quotes required). Esc prints nothing. Ctrl-d destroys a linked worktree after confirm (docker compose downand/orbin/teardownwhen present, thengit worktree remove). Cannot destroy the main checkout or the worktree the shell is in. -
git stash-and-checkout <branch>— Stash (including untracked), checkout the branch, then pop the matching WIP stash if any. -
git staging [branch]— Sync the given branch (or current) with main: stash-and-checkout → ff-all-branches → merge main → push → stash, checkout staging → fetch, reset --hard origin/staging → merge branch → push → stash-and-checkout back. Use when you want to land a feature branch into astagingbranch. -
git merge-po <base> <local> <remote>— Three-way merge driver for gettext PO files. Usesmsguniq,msgcat,msgmerge,msggrep. Not meant to be run by hand; use as a merge driver (see below). -
git changes [git log args…]— Show commits on the current branch that are not in the primary remote branch. The primary branch is detected fromorigin/HEAD, ororigin/main, ororigin/master. Extra arguments are passed through togit log(for examplegit changes --statorgit changes -- path/to/file). Global-v/-xstay git-whistles flags; use--if you need to pass those togit log. -
git-whistles shim [--dir DIR]/git-whistles unshim [--dir DIR]— Add or removegit-<subcommand>symlinks to the main binary (notshim/unshimthemselves). Default dir:/usr/local/bin.
You can run the binary as git-whistles <subcommand> or install shims and run e.g. git-chop or git merge-po (after git-chop / git-merge-po are on PATH).
merge-po setup
Use as a Git merge driver for .po / .pot files.
Repo-local — in .git/config:
[merge "pofile"]
name = Gettext merge driver
driver = git merge-po %O %A %BIn .gitattributes:
*.po merge=pofile
*.pot merge=pofile
Global — in ~/.gitconfig:
[core]
attributesfile = ~/.gitattributes
[merge "pofile"]
name = Gettext merge driver
driver = git merge-po %O %A %BAnd in ~/.gitattributes:
*.po merge=pofile
*.pot merge=pofile
Requires gettext (msguniq, msgcat, msgmerge, msggrep) on PATH.
Build and test
Gettext (msguniq, msgcat, msgmerge, msggrep) is mandatory for the full test suite. Install it first (e.g. apt-get install gettext, brew install gettext).
cargo build --release
cargo testLicense
MIT.