PRE-COMMIT-TRY-REPO(1)
π pre-commit-try-repo β the manual, but make it make sense
okay bestie, welcome to pre-commit-try-repo(1), a User Commands page, and it's literally the move when you wanna try the hooks in a repository β super useful for developing new hooks. like, you're building a hook, you wanna test it against a real repo, boom, this is your girl. π
β¨ NAME β¨
pre-commit-try-repo β Try the hooks in a repository, useful for developing new hooks. no cap, that's the whole job description and she ate. π
πΈ SYNOPSIS πΈ
pre-commit try-repo [-h] [--color {auto,always,never}] [-c CONFIG]
[--ref REF] [--verbose] [--all-files | --files [FILES ...]]
[--show-diff-on-failure]
[--hook-stage {commit-msg,post-checkout,post-commit,post-merge,post-rewrite,pre-commit,pre-merge-commit,pre-push,pre-rebase,prepare-commit-msg,manual}]
[--remote-branch REMOTE_BRANCH] [--local-branch LOCAL_BRANCH]
[--from-ref FROM_REF] [--to-ref TO_REF]
[--pre-rebase-upstream PRE_REBASE_UPSTREAM]
[--pre-rebase-branch PRE_REBASE_BRANCH]
[--commit-msg-filename COMMIT_MSG_FILENAME]
[--prepare-commit-message-source PREPARE_COMMIT_MESSAGE_SOURCE]
[--commit-object-name COMMIT_OBJECT_NAME] [--remote-name REMOTE_NAME]
[--remote-url REMOTE_URL] [--checkout-type CHECKOUT_TYPE]
[--is-squash-merge IS_SQUASH_MERGE] [--rewrite-command REWRITE_COMMAND]
repo [hook]
π OPTIONS π
π«Ά POSITIONAL ARGUMENTS
repoβ Repository to source hooks from. like, where the hooks live, babe.hookβ A single hook-id to run. just the one. one hook. main character energy, singular. β
π OPTIONAL ARGUMENTS
-h,--helpβ Show a help message and exit. the classic. when in doubt, ask for help, it's giving self-care. π--color {auto,always,never}β Whether to use color in output. Defaults toauto. aesthetic choices matter. β¨--ref,--rev REFβ Manually select a rev to run against, otherwise theHEADrevision will be used. you pick the rev, orHEADpicks you. π-c,--config CONFIGβ Path to alternate config file. for when your config is not like other configs. π¦--verbose,-vβ (the page gives this one no description at all, so it's justβ¦ sitting there, mysterious, iconic) π--all-files,-aβ Run on all the files in the repo. all of them. every single one. no crumbs. π₯--files [FILES ...]β Specific filenames to run hooks on. when you're being picky, as you should. π--show-diff-on-failureβ When hooks fail, rungit-diff(1)directly afterward. so you can see exactly what went wrong, in real time. π--hook-stage {commit-msg,post-checkout,post-commit,post-merge,post-rewrite,pre-commit,pre-merge-commit,pre-push,pre-rebase,prepare-commit-msg,manual}]β The stage during which the hook is fired. One ofcommit-msg,post-checkout,post-commit,post-merge,post-rewrite,pre-commit,pre-merge-commit,pre-push,pre-rebase,prepare-commit-msg,manual. (and yes, the curly-brace list on the flag itself has that lil]on the end β that's exactly how it's written here, we're not touching it, she's perfect as she is π)--remote-branch REMOTE_BRANCHβ Remote branch ref used bygit-push(1). π‘--local-branch LOCAL_BRANCHβ Local branch ref used bygit-push(1). π--from-ref,--source,-s FROM_REFβ (For usage with--to-ref) β this option represents the original ref in afrom_ref...to_refdiff expression. Forpre-pushhooks, this represents the branch you are pushing to. Forpost-checkouthooks, this represents the branch that was previously checked out. the before girlie. π¦--to-ref,--origin,-o TO_REFβ (For usage with--from-ref) β this option represents the destination ref in afrom_ref...to_refdiff expression. Forpre-pushhooks, this represents the branch being pushed. Forpost-checkouthooks, this represents the branch that is now checked out. the after girlie. β¨--pre-rebase-upstream PRE_REBASE_UPSTREAMβ The upstream from which the series was forked. π±--pre-rebase-branch PRE_REBASE_BRANCHβ The branch being rebased, and is not set when rebasing the current branch. so if you're rebasing the current branch, she's a no-show. π--commit-msg-filename COMMIT_MSG_FILENAMEβ Filename to check when running duringcommit-msg. π--prepare-commit-message-source PREPARE_COMMIT_MESSAGE_SOURCEβ Source of the commit message (typically the second argument to.git/hooks/prepare-commit-msg). π--commit-object-name COMMIT_OBJECT_NAMEβ Commit object name (typically the third argument to.git/hooks/prepare-commit-msg). πͺ©--remote-name REMOTE_NAMEβ Remote name used bygit-push(1). π--remote-url REMOTE_URLβ Remote url used bygit-push(1). π--checkout-type CHECKOUT_TYPEβ Indicates whether the checkout was a branch checkout (changing branches,flag=1) or a file checkout (retrieving a file from the index,flag=0). two flags, two vibes. π«--is-squash-merge IS_SQUASH_MERGEβ During apost-mergehook, indicates whether the merge was a squash merge. π₯ (squash. get it. okay moving on)--rewrite-command REWRITE_COMMANDβ During apost-rewritehook, specifies the command that invoked the rewrite. π οΈ
π SEE ALSO π
go read these too, they're the whole friend group:
pre-commit-autoupdate(1),pre-commit-clean(1),pre-commit-gc(1),pre-commit-init-templatedir(1),pre-commit-install(1),pre-commit-install-hooks(1),pre-commit-migrate-config(1),pre-commit-run(1),pre-commit-sample-config(1),pre-commit-uninstall(1),pre-commit-validate-config(1),pre-commit-validate-manifest(1),pre-commit-help(1)pre-commit(1)git-diff(1)git-push(1)
fr fr bestie, go test those hooks. your future self is obsessed with you. π«Ά
mwah π β this page is PRE-COMMIT-TRY-REPO(1) from February 2025, and that's the whole sign-off. periodt. π
π¦ where this page comes from
- epel 10: pre-commit 4.7.0-1.el10_3 Β· MIT
- fedora 43: pre-commit 4.3.0-3.fc43 Β· MIT
- fedora 43: pre-commit 4.6.2-1.fc43
- fedora 43: pre-commit 4.7.0-1.fc43 Β· MIT
- fedora 44: pre-commit 4.5.1-2.fc44 Β· MIT
- fedora 44: pre-commit 4.6.2-1.fc44
- fedora 44: pre-commit 4.7.0-1.fc44 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms