GITHOOKS(5) Git GITHOOKS(5) (NAME) githooks - Git (SYNOPSIS) $GIT_DIR/hooks/* ( `git config core.hooksPath`/*) (DESCRIPTION) (Hooks) Git . (executable bit) . $GIT_DIR/hooks core.hooksPath ( git-config(1) ). Git $GIT_DIR (bare) (working tree) . push (pre-receive update post-receive post-update push-to-checkout) $GIT_DIR . GIT_DIR GIT_WORK_TREE (export) Git . Git Git . : local_desc=$(git describe) foreign_desc=$(unset $(git rev-parse --local-env-vars); git -C ../foreign-repo describe) (stdin) . . git init . "TEMPLATE DIRECTORY" git- init(1) . << >> Git . . (HOOKS) applypatch-msg git-am(1) . . git am (patch) . . . applypatch-msg commit-msg . pre-applypatch git-am(1) . . . . pre-applypatch pre-commit ( ). post-applypatch git-am(1) . . git am . pre-commit git-commit(1) --no-verify . . git commit . git commit GIT_EDITOR=: . pre-commit ASCII (trailing whitespace) . ASCII hooks.allownonascii true . pre-merge-commit git-merge(1) --no-verify . . git merge . pre-merge-commit pre-commit ( ) . GIT_EDITOR=: . ( git-merge(1) ). pre-commit . prepare-commit-msg git-commit(1) . . . : message ( -m -F ) template ( -t commit.template ) merge ( .git/MERGE_MSG ) squash ( .git/SQUASH_MSG ) commit ( -c -C --amend ). git commit . --no-verify . . pre-commit . prepare-commit-msg Git . commit-msg git-commit(1) git-merge(1) --no-verify . : . . . . commit-msg Signed-off-by . post-commit git-commit(1) . . git commit . pre-rebase git-rebase(1) (rebase) . . (upstream) . . post-checkout git-checkout(1) git-switch(1) . : HEAD HEAD ( ) ( =1) ( / =0). git switch git checkout . git-clone(1) --no-checkout (-n) . null-ref HEAD 1 . git worktree add --no-checkout . HEAD ( ) . post-merge git-merge(1) git pull . : (squash merge) . git merge . pre- commit ( / ACL ) . contrib/hooks/setgitperms.perl . pre-push git-push(1) (push) . . (stdin) : SP SP SP LF git push origin master:foreign : refs/heads/master 67890 refs/heads/foreign 12345 . . (delete) . ( HEAD~ ) . git push . push (stderr) . pre-receive git-receive-pack(1) git push . . . . : SP SP LF . . . update . (stdout) (stderr) git send-pack echo . push git push --push-option=... GIT_PUSH_OPTION_COUNT GIT_PUSH_OPTION_0 GIT_PUSH_OPTION_1 . push . push (GIT_PUSH_OPTION_COUNT=0). "Quarantine Environment" git-receive-pack(1) . update git-receive-pack(1) git push . . . : o o o . update . git receive-pack . (forced) << >> (fast- forward only) . old..new . . post-receive . git . git git- shell(1) . git send-pack echo . update -- hooks.allowunannotated false -- push (unannotated tags) . proc-receive git-receive-pack(1) . receive.procReceiveRefs receive-pack execute_commands() . receive-pack . . pkt-line receive-pack push . S receive-pack H . # . S: PKT-LINE(version=1\0push-options atomic...) S: flush-pkt H: PKT-LINE(version=1\0push-options...) H: flush-pkt # . S: PKT-LINE( ) S: ... ... S: flush-pkt # push-options 'push-options' . S: PKT-LINE(push-option) S: ... ... S: flush-pkt # . # OK: . H: PKT-LINE(ok ) # NO: . H: PKT-LINE(ng ) # : 'receive-pack' . H: PKT-LINE(ok ) H: PKT-LINE(option fall-through) # OK . # option . H: PKT-LINE(ok ) H: PKT-LINE(option refname ) H: PKT-LINE(option old-oid ) H: PKT-LINE(option new-oid ) H: PKT-LINE(option forced-update) H: ... ... H: flush-pkt proc-receive old-oid proc-receive old-oid . "option" "ok" . . proc-receive push (atomic) . post-receive git-receive-pack(1) git push . . . pre-receive . git receive-pack . post-update . git send-pack echo . post-receive post-receive-email contrib/hooks Git . push git push --push-option=... GIT_PUSH_OPTION_COUNT GIT_PUSH_OPTION_0 GIT_PUSH_OPTION_1 . . (GIT_PUSH_OPTION_COUNT=0). "post-receive" git-receive-pack(1) . post-update git-receive-pack(1) git push . . . git receive-pack . post-update push old..new . post-receive . post-update git update-server-info ( HTTP) . HTTP . git send-pack . reference-transaction Git . (preparing) (prepared) (committed) (aborted) . (symbolic references) . : o "preparing": . o "prepared": . o "committed": () . o "aborted": . : SP SP LF . . git rev-parse . "preparing" : . . ref: ref:. "preparing" "prepared" . . "aborted" . push-to-checkout git-receive-pack(1) git push push (checkout) receive.denyCurrentBranch updateInstead . . . . push ( ). . git read-tree -u -m HEAD "$1" git fetch git push git read-tree -u -m git switch git checkout ( ) . pre-auto-gc git gc --auto ( git-gc(1) ). git gc --auto . post-rewrite (git-commit(1) --amend git-rebase(1) git-fast-import(1) git-filter-repo[1] !). : amend rebase. . stdin : SP [ SP ] LF extra-info . SP . extra-info . (notes) ( "notes.rewrite." git-config(1) ) . : rebase squash fixup . new-object-name . rebase . sendemail-validate git-send-email(1) . : . . . SMTP . SMTP (MTA) . MTA $2 $1 . . Tab . From: Example To: to@example.com Cc: cc@example.com, A , One , two@example.com Subject: PATCH-STRING git send-email . : GIT_SENDEMAIL_FILE_COUNTER ( FIFO) . GIT_SENDEMAIL_FILE_TOTAL . GIT_SENDEMAIL_FILE_TOTAL ( FIFO). cover letter . . sendemail-validate Git ( cover letter) . . fsmonitor-watchman core.fsmonitor .git/hooks/fsmonitor-watchman .git/hooks/fsmonitor-watchmanv2 ( ) . : (1) . : (2) . watchman (clock id) . NUL stdout . stdout . . NUL . . . . (untracked) . git << >> / . git . . p4-changelist git-p4 submit . p4-changelist changelist . --no-verify . : changelist . . changelist . Submit . git-p4 submit --help . p4-prepare-changelist git-p4 submit . p4-prepare-changelist changelist . : changelist . . --no-verify . --prepare-p4-only . git-p4 submit --help . p4-post-changelist git-p4 submit . p4-post-changelist (submit) P4 . git p4 submit . git-p4 submit --help . p4-pre-submit git-p4 submit . . git-p4 submit . --no-verify . git-p4 submit --help . post-index-change () read-cache.c do_write_locked_index . "1" "0" . skip-worktree "1" skip-worktree "0" . "1" . "1", "1" . (SEE ALSO) git-hook(1) (GIT) git(1) (NOTES) 1. git-filter-repo https://github.com/newren/git-filter-repo Git 2.55.0 2026-06-29 GITHOOKS(5)