PRE-COMMIT-TRY-REPO(1)

πŸ“¦ version 4.7.0, in epel 10, fedora 43, fedora 44

πŸ’… 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 to auto. aesthetic choices matter. ✨
  • --ref, --rev REF β€” Manually select a rev to run against, otherwise the HEAD revision will be used. you pick the rev, or HEAD picks 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, run git-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 of commit-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 by git-push(1). πŸ“‘
  • --local-branch LOCAL_BRANCH β€” Local branch ref used by git-push(1). 🏠
  • --from-ref, --source, -s FROM_REF β€” (For usage with --to-ref) – this option represents the original ref in a from_ref...to_ref diff expression. For pre-push hooks, this represents the branch you are pushing to. For post-checkout hooks, 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 a from_ref...to_ref diff expression. For pre-push hooks, this represents the branch being pushed. For post-checkout hooks, 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 during commit-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 by git-push(1). πŸ“›
  • --remote-url REMOTE_URL β€” Remote url used by git-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 a post-merge hook, indicates whether the merge was a squash merge. πŸ₯’ (squash. get it. okay moving on)
  • --rewrite-command REWRITE_COMMAND β€” During a post-rewrite hook, specifies the command that invoked the rewrite. πŸ› οΈ

πŸ’– SEE ALSO πŸ’–

go read these too, they're the whole friend group:


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