1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
6 <meta http-equiv=
"Content-Type" content=
"application/xhtml+xml; charset=UTF-8" />
7 <meta name=
"generator" content=
"AsciiDoc 10.2.0" />
8 <title>githooks(
5)
</title>
9 <style type=
"text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
14 font-family: Georgia,serif;
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
22 #author, #revnumber, #revdate, #revremark,
24 font-family: Arial,Helvetica,sans-serif;
28 margin:
1em
5%
1em
5%;
33 text-decoration: underline;
49 h1, h2, h3, h4, h5, h6 {
57 border-bottom:
2px solid silver;
77 border:
1px solid silver;
88 ul
> li { color: #aaa; }
89 ul
> li
> * { color: black; }
91 .monospaced, code, pre {
92 font-family:
"Courier New", Courier, monospace;
99 white-space: pre-wrap;
109 #revnumber, #revdate, #revremark {
114 border-top:
2px solid silver;
120 padding-bottom:
0.5em;
124 padding-bottom:
0.5em;
129 margin-bottom:
1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
135 margin-bottom:
1.5em;
137 div.admonitionblock {
139 margin-bottom:
2.0em;
144 div.content { /* Block element content. */
148 /* Block element titles. */
149 div.title, caption.title {
154 margin-bottom:
0.5em;
160 td div.title:first-child {
163 div.content div.title:first-child {
166 div.content + div.title {
170 div.sidebarblock
> div.content {
172 border:
1px solid #dddddd;
173 border-left:
4px solid #f0f0f0;
177 div.listingblock
> div.content {
178 border:
1px solid #dddddd;
179 border-left:
5px solid #f0f0f0;
184 div.quoteblock, div.verseblock {
188 border-left:
5px solid #f0f0f0;
192 div.quoteblock
> div.attribution {
197 div.verseblock
> pre.content {
198 font-family: inherit;
201 div.verseblock
> div.attribution {
205 /* DEPRECATED: Pre version
8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
210 div.admonitionblock .icon {
214 text-decoration: underline;
216 padding-right:
0.5em;
218 div.admonitionblock td.content {
220 border-left:
3px solid #dddddd;
223 div.exampleblock
> div.content {
224 border-left:
3px solid #dddddd;
228 div.imageblock div.content { padding-left:
0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
234 margin-bottom:
0.8em;
247 list-style-position: outside;
250 list-style-type: decimal;
253 list-style-type: lower-alpha;
256 list-style-type: upper-alpha;
259 list-style-type: lower-roman;
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
269 margin-bottom:
0.1em;
281 margin-bottom:
0.8em;
284 padding-bottom:
15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
292 padding-right:
0.8em;
298 div.hdlist.compact tr {
307 .footnote, .footnoteref {
311 span.footnote, span.footnoteref {
312 vertical-align: super;
316 margin:
20px
0 20px
0;
320 #footnotes div.footnote {
326 border-top:
1px solid silver;
335 padding-right:
0.5em;
336 padding-bottom:
0.3em;
344 #footer-badges { display: none; }
348 margin-bottom:
2.5em;
356 margin-bottom:
0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size:
2em; }
411 span.small { font-size:
0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
427 margin-bottom:
1.5em;
429 div.tableblock
> table {
430 border:
3px solid #
527bbd;
432 thead, p.table.header {
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock
> table[
frame=
"void"] {
443 div.tableblock
> table[
frame=
"hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock
> table[
frame=
"vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
460 margin-bottom:
1.5em;
462 thead, p.tableblock.header {
473 border-color: #
527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
480 border-color: #
527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
498 th.tableblock.halign-center, td.tableblock.halign-center {
501 th.tableblock.halign-right, td.tableblock.halign-right {
505 th.tableblock.valign-top, td.tableblock.valign-top {
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
523 padding-bottom:
0.5em;
524 border-top:
2px solid silver;
525 border-bottom:
2px solid silver;
530 body.manpage div.sectionbody {
535 body.manpage div#toc { display: none; }
540 <script type=
"text/javascript">
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September
2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September
2006. License: GPL */
559 /* modified by Stuart Rackham,
2006,
2009. License: GPL */
562 toc: function (toclevels) {
564 function getText(el) {
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType ==
3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
569 else if (i.firstChild != null)
575 function TocEntry(el, text, toclevel) {
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([
1-'+(toclevels+
1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType ==
1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute(
"class") || i.getAttribute(
"className")) !=
"float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[
1]-
1);
602 var toc = document.getElementById(
"toc");
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
610 for (i =
0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute(
"class")
614 && entry.getAttribute(
"class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i =
0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById(
"content"), toclevels);
623 for (var i =
0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id ==
"")
626 entry.element.id =
"_toc_" + i;
627 var a = document.createElement(
"a");
628 a.href =
"#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement(
"div");
632 div.className =
"toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length ==
0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/
2005/
07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
651 var noteholder = document.getElementById(
"footnotes");
655 var entriesToRemove = [];
656 for (i =
0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute(
"class") ==
"footnote")
659 entriesToRemove.push(entry);
661 for (i =
0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById(
"content");
667 var spans = cont.getElementsByTagName(
"span");
670 for (i=
0; i
<spans.length; i++) {
671 if (spans[i].className ==
"footnote") {
673 var note = spans[i].getAttribute(
"data-note");
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[
1];
679 "[<a id='_footnoteref_" + n +
"' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n +
"</a>]";
681 spans[i].setAttribute(
"data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n +
"'>" +
685 "<a href='#_footnoteref_" + n +
"' title='Return to text'>" +
686 n +
"</a>. " + note +
"</div>";
687 var id =spans[i].getAttribute(
"id");
688 if (id != null) refs[
"#"+id] = n;
692 noteholder.parentNode.removeChild(noteholder);
694 // Process footnoterefs.
695 for (i=
0; i
<spans.length; i++) {
696 if (spans[i].className ==
"footnoteref") {
697 var href = spans[i].getElementsByTagName(
"a")[
0].getAttribute(
"href");
698 href = href.match(/#.*/)[
0]; // Because IE return full URL.
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n +
"</a>]";
708 install: function(toclevels) {
711 function reinstall() {
712 asciidoc.footnotes();
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
723 timerId = setInterval(reinstall,
500);
724 if (document.addEventListener)
725 document.addEventListener(
"DOMContentLoaded", reinstallAndRemoveTimer, false);
727 window.onload = reinstallAndRemoveTimer;
735 <body class=
"manpage">
738 githooks(
5) Manual Page
741 <div class=
"sectionbody">
749 <h2 id=
"_synopsis">SYNOPSIS
</h2>
750 <div class=
"sectionbody">
751 <div class=
"paragraph"><p>$GIT_DIR/hooks/* (or `git config core.hooksPath`/*)
</p></div>
755 <h2 id=
"_description">DESCRIPTION
</h2>
756 <div class=
"sectionbody">
757 <div class=
"paragraph"><p>Hooks are programs you can place in a hooks directory to trigger
758 actions at certain points in git
’s execution. Hooks that don
’t have
759 the executable bit set are ignored.
</p></div>
760 <div class=
"paragraph"><p>By default the hooks directory is
<code>$GIT_DIR/hooks
</code>, but that can be
761 changed via the
<code>core.hooksPath
</code> configuration variable (see
762 <a href=
"git-config.html">git-config(
1)
</a>).
</p></div>
763 <div class=
"paragraph"><p>Before Git invokes a hook, it changes its working directory to either
764 $GIT_DIR in a bare repository or the root of the working tree in a non-bare
765 repository. An exception are hooks triggered during a push (
<em>pre-receive
</em>,
766 <em>update
</em>,
<em>post-receive
</em>,
<em>post-update
</em>,
<em>push-to-checkout
</em>) which are always
767 executed in $GIT_DIR.
</p></div>
768 <div class=
"paragraph"><p>Environment variables, such as
<code>GIT_DIR
</code>,
<code>GIT_WORK_TREE
</code>, etc., are exported
769 so that Git commands run by the hook can correctly locate the repository. If
770 your hook needs to invoke Git commands in a foreign repository or in a
771 different working tree of the same repository, then it should clear these
772 environment variables so they do not interfere with Git operations at the
773 foreign location. For example:
</p></div>
774 <div class=
"listingblock">
775 <div class=
"content">
776 <pre><code>local_desc=$(git describe)
777 foreign_desc=$(unset $(git rev-parse --local-env-vars); git -C ../foreign-repo describe)
</code></pre>
779 <div class=
"paragraph"><p>Hooks can get their arguments via the environment, command-line
780 arguments, and stdin. See the documentation for each hook below for
782 <div class=
"paragraph"><p><code>git init
</code> may copy hooks to the new repository, depending on its
783 configuration. See the
"TEMPLATE DIRECTORY" section in
784 <a href=
"git-init.html">git-init(
1)
</a> for details. When the rest of this document refers
785 to
"default hooks" it
’s talking about the default template shipped
787 <div class=
"paragraph"><p>The currently supported hooks are described below.
</p></div>
791 <h2 id=
"_hooks">HOOKS
</h2>
792 <div class=
"sectionbody">
794 <h3 id=
"_applypatch_msg">applypatch-msg
</h3>
795 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-am.html">git-am(
1)
</a>. It takes a single
796 parameter, the name of the file that holds the proposed commit
797 log message. Exiting with a non-zero status causes
<code>git am
</code> to abort
798 before applying the patch.
</p></div>
799 <div class=
"paragraph"><p>The hook is allowed to edit the message file in place, and can
800 be used to normalize the message into some project standard
801 format. It can also be used to refuse the commit after inspecting
802 the message file.
</p></div>
803 <div class=
"paragraph"><p>The default
<em>applypatch-msg
</em> hook, when enabled, runs the
804 <em>commit-msg
</em> hook, if the latter is enabled.
</p></div>
807 <h3 id=
"_pre_applypatch">pre-applypatch
</h3>
808 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-am.html">git-am(
1)
</a>. It takes no parameter, and is
809 invoked after the patch is applied, but before a commit is made.
</p></div>
810 <div class=
"paragraph"><p>If it exits with non-zero status, then the working tree will not be
811 committed after applying the patch.
</p></div>
812 <div class=
"paragraph"><p>It can be used to inspect the current working tree and refuse to
813 make a commit if it does not pass certain test.
</p></div>
814 <div class=
"paragraph"><p>The default
<em>pre-applypatch
</em> hook, when enabled, runs the
815 <em>pre-commit
</em> hook, if the latter is enabled.
</p></div>
818 <h3 id=
"_post_applypatch">post-applypatch
</h3>
819 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-am.html">git-am(
1)
</a>. It takes no parameter,
820 and is invoked after the patch is applied and a commit is made.
</p></div>
821 <div class=
"paragraph"><p>This hook is meant primarily for notification, and cannot affect
822 the outcome of
<code>git am
</code>.
</p></div>
825 <h3 id=
"_pre_commit">pre-commit
</h3>
826 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-commit.html">git-commit(
1)
</a>, and can be bypassed
827 with the
<code>--no-verify
</code> option. It takes no parameters, and is
828 invoked before obtaining the proposed commit log message and
829 making a commit. Exiting with a non-zero status from this script
830 causes the
<code>git commit
</code> command to abort before creating a commit.
</p></div>
831 <div class=
"paragraph"><p>The default
<em>pre-commit
</em> hook, when enabled, catches introduction
832 of lines with trailing whitespaces and aborts the commit when
833 such a line is found.
</p></div>
834 <div class=
"paragraph"><p>All the
<code>git commit
</code> hooks are invoked with the environment
835 variable
<code>GIT_EDITOR=:
</code> if the command will not bring up an editor
836 to modify the commit message.
</p></div>
837 <div class=
"paragraph"><p>The default
<em>pre-commit
</em> hook, when enabled
—and with the
838 <code>hooks.allownonascii
</code> config option unset or set to false
—prevents
839 the use of non-ASCII filenames.
</p></div>
842 <h3 id=
"_pre_merge_commit">pre-merge-commit
</h3>
843 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-merge.html">git-merge(
1)
</a>, and can be bypassed
844 with the
<code>--no-verify
</code> option. It takes no parameters, and is
845 invoked after the merge has been carried out successfully and before
846 obtaining the proposed commit log message to
847 make a commit. Exiting with a non-zero status from this script
848 causes the
<code>git merge
</code> command to abort before creating a commit.
</p></div>
849 <div class=
"paragraph"><p>The default
<em>pre-merge-commit
</em> hook, when enabled, runs the
850 <em>pre-commit
</em> hook, if the latter is enabled.
</p></div>
851 <div class=
"paragraph"><p>This hook is invoked with the environment variable
852 <code>GIT_EDITOR=:
</code> if the command will not bring up an editor
853 to modify the commit message.
</p></div>
854 <div class=
"paragraph"><p>If the merge cannot be carried out automatically, the conflicts
855 need to be resolved and the result committed separately (see
856 <a href=
"git-merge.html">git-merge(
1)
</a>). At that point, this hook will not be executed,
857 but the
<em>pre-commit
</em> hook will, if it is enabled.
</p></div>
860 <h3 id=
"_prepare_commit_msg">prepare-commit-msg
</h3>
861 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-commit.html">git-commit(
1)
</a> right after preparing the
862 default log message, and before the editor is started.
</p></div>
863 <div class=
"paragraph"><p>It takes one to three parameters. The first is the name of the file
864 that contains the commit log message. The second is the source of the commit
865 message, and can be:
<code>message
</code> (if a
<code>-m
</code> or
<code>-F
</code> option was
866 given);
<code>template
</code> (if a
<code>-t
</code> option was given or the
867 configuration option
<code>commit.template
</code> is set);
<code>merge
</code> (if the
868 commit is a merge or a
<code>.git/MERGE_MSG
</code> file exists);
<code>squash
</code>
869 (if a
<code>.git/SQUASH_MSG
</code> file exists); or
<code>commit
</code>, followed by
870 a commit object name (if a
<code>-c
</code>,
<code>-C
</code> or
<code>--amend
</code> option was given).
</p></div>
871 <div class=
"paragraph"><p>If the exit status is non-zero,
<code>git commit
</code> will abort.
</p></div>
872 <div class=
"paragraph"><p>The purpose of the hook is to edit the message file in place, and
873 it is not suppressed by the
<code>--no-verify
</code> option. A non-zero exit
874 means a failure of the hook and aborts the commit. It should not
875 be used as replacement for pre-commit hook.
</p></div>
876 <div class=
"paragraph"><p>The sample
<code>prepare-commit-msg
</code> hook that comes with Git removes the
877 help message found in the commented portion of the commit template.
</p></div>
880 <h3 id=
"_commit_msg">commit-msg
</h3>
881 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-commit.html">git-commit(
1)
</a> and
<a href=
"git-merge.html">git-merge(
1)
</a>, and can be
882 bypassed with the
<code>--no-verify
</code> option. It takes a single parameter,
883 the name of the file that holds the proposed commit log message.
884 Exiting with a non-zero status causes the command to abort.
</p></div>
885 <div class=
"paragraph"><p>The hook is allowed to edit the message file in place, and can be used
886 to normalize the message into some project standard format. It
887 can also be used to refuse the commit after inspecting the message
889 <div class=
"paragraph"><p>The default
<em>commit-msg
</em> hook, when enabled, detects duplicate
890 <code>Signed-off-by
</code> trailers, and aborts the commit if one is found.
</p></div>
893 <h3 id=
"_post_commit">post-commit
</h3>
894 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-commit.html">git-commit(
1)
</a>. It takes no parameters, and is
895 invoked after a commit is made.
</p></div>
896 <div class=
"paragraph"><p>This hook is meant primarily for notification, and cannot affect
897 the outcome of
<code>git commit
</code>.
</p></div>
900 <h3 id=
"_pre_rebase">pre-rebase
</h3>
901 <div class=
"paragraph"><p>This hook is called by
<a href=
"git-rebase.html">git-rebase(
1)
</a> and can be used to prevent a
902 branch from getting rebased. The hook may be called with one or
903 two parameters. The first parameter is the upstream from which
904 the series was forked. The second parameter is the branch being
905 rebased, and is not set when rebasing the current branch.
</p></div>
908 <h3 id=
"_post_checkout">post-checkout
</h3>
909 <div class=
"paragraph"><p>This hook is invoked when a
<a href=
"git-checkout.html">git-checkout(
1)
</a> or
910 <a href=
"git-switch.html">git-switch(
1)
</a> is run after having updated the
911 worktree. The hook is given three parameters: the ref of the previous HEAD,
912 the ref of the new HEAD (which may or may not have changed), and a flag
913 indicating whether the checkout was a branch checkout (changing branches,
914 flag=
1) or a file checkout (retrieving a file from the index, flag=
0).
915 This hook cannot affect the outcome of
<code>git switch
</code> or
<code>git checkout
</code>,
916 other than that the hook
’s exit status becomes the exit status of
917 these two commands.
</p></div>
918 <div class=
"paragraph"><p>It is also run after
<a href=
"git-clone.html">git-clone(
1)
</a>, unless the
<code>--no-checkout
</code> (
<code>-n
</code>) option is
919 used. The first parameter given to the hook is the null-ref, the second the
920 ref of the new HEAD and the flag is always
1. Likewise for
<code>git worktree add
</code>
921 unless
<code>--no-checkout
</code> is used.
</p></div>
922 <div class=
"paragraph"><p>This hook can be used to perform repository validity checks, auto-display
923 differences from the previous HEAD if different, or set working dir metadata
924 properties.
</p></div>
927 <h3 id=
"_post_merge">post-merge
</h3>
928 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-merge.html">git-merge(
1)
</a>, which happens when a
<code>git pull
</code>
929 is done on a local repository. The hook takes a single parameter, a status
930 flag specifying whether or not the merge being done was a squash merge.
931 This hook cannot affect the outcome of
<code>git merge
</code> and is not executed,
932 if the merge failed due to conflicts.
</p></div>
933 <div class=
"paragraph"><p>This hook can be used in conjunction with a corresponding pre-commit hook to
934 save and restore any form of metadata associated with the working tree
935 (e.g.: permissions/ownership, ACLS, etc). See contrib/hooks/setgitperms.perl
936 for an example of how to do this.
</p></div>
939 <h3 id=
"_pre_push">pre-push
</h3>
940 <div class=
"paragraph"><p>This hook is called by
<a href=
"git-push.html">git-push(
1)
</a> and can be used to prevent
941 a push from taking place. The hook is called with two parameters
942 which provide the name and location of the destination remote, if a
943 named remote is not being used both values will be the same.
</p></div>
944 <div class=
"paragraph"><p>Information about what is to be pushed is provided on the hook
’s standard
945 input with lines of the form:
</p></div>
946 <div class=
"literalblock">
947 <div class=
"content">
948 <pre><code><local ref
> SP
<local object name
> SP
<remote ref
> SP
<remote object name
> LF
</code></pre>
950 <div class=
"paragraph"><p>For instance, if the command
<code>git push origin master:foreign
</code> were run the
951 hook would receive a line like the following:
</p></div>
952 <div class=
"literalblock">
953 <div class=
"content">
954 <pre><code>refs/heads/master
67890 refs/heads/foreign
12345</code></pre>
956 <div class=
"paragraph"><p>although the full object name would be supplied. If the foreign ref does not
957 yet exist the
<code><remote object name
></code> will be the all-zeroes object name. If a
958 ref is to be deleted, the
<code><local ref
></code> will be supplied as
<code>(delete)
</code> and the
959 <code><local object name
></code> will be the all-zeroes object name. If the local commit
960 was specified by something other than a name which could be expanded (such as
961 <code>HEAD~
</code>, or an object name) it will be supplied as it was originally given.
</p></div>
962 <div class=
"paragraph"><p>If this hook exits with a non-zero status,
<code>git push
</code> will abort without
963 pushing anything. Information about why the push is rejected may be sent
964 to the user by writing to standard error.
</p></div>
967 <h3 id=
"pre-receive">pre-receive
</h3>
968 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-receive-pack.html">git-receive-pack(
1)
</a> when it reacts to
969 <code>git push
</code> and updates reference(s) in its repository.
970 Just before starting to update refs on the remote repository, the
971 pre-receive hook is invoked. Its exit status determines the success
972 or failure of the update.
</p></div>
973 <div class=
"paragraph"><p>This hook executes once for the receive operation. It takes no
974 arguments, but for each ref to be updated it receives on standard
975 input a line of the format:
</p></div>
976 <div class=
"literalblock">
977 <div class=
"content">
978 <pre><code><old-value
> SP
<new-value
> SP
<ref-name
> LF
</code></pre>
980 <div class=
"paragraph"><p>where
<code><old-value
></code> is the old object name stored in the ref,
981 <code><new-value
></code> is the new object name to be stored in the ref and
982 <code><ref-name
></code> is the full name of the ref.
983 When creating a new ref,
<code><old-value
></code> is the all-zeroes object name.
</p></div>
984 <div class=
"paragraph"><p>If the hook exits with non-zero status, none of the refs will be
985 updated. If the hook exits with zero, updating of individual refs can
986 still be prevented by the
<a href=
"#update"><em>update
</em></a> hook.
</p></div>
987 <div class=
"paragraph"><p>Both standard output and standard error output are forwarded to
988 <code>git send-pack
</code> on the other end, so you can simply
<code>echo
</code> messages
989 for the user.
</p></div>
990 <div class=
"paragraph"><p>The number of push options given on the command line of
991 <code>git push --push-option=...
</code> can be read from the environment
992 variable
<code>GIT_PUSH_OPTION_COUNT
</code>, and the options themselves are
993 found in
<code>GIT_PUSH_OPTION_0
</code>,
<code>GIT_PUSH_OPTION_1
</code>,
…
994 If it is negotiated to not use the push options phase, the
995 environment variables will not be set. If the client selects
996 to use push options, but doesn
’t transmit any, the count variable
997 will be set to zero,
<code>GIT_PUSH_OPTION_COUNT=
0</code>.
</p></div>
998 <div class=
"paragraph"><p>See the section on
"Quarantine Environment" in
999 <a href=
"git-receive-pack.html">git-receive-pack(
1)
</a> for some caveats.
</p></div>
1002 <h3 id=
"update">update
</h3>
1003 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-receive-pack.html">git-receive-pack(
1)
</a> when it reacts to
1004 <code>git push
</code> and updates reference(s) in its repository.
1005 Just before updating the ref on the remote repository, the update hook
1006 is invoked. Its exit status determines the success or failure of
1007 the ref update.
</p></div>
1008 <div class=
"paragraph"><p>The hook executes once for each ref to be updated, and takes
1009 three parameters:
</p></div>
1010 <div class=
"ulist"><ul>
1013 the name of the ref being updated,
1018 the old object name stored in the ref,
1023 and the new object name to be stored in the ref.
1027 <div class=
"paragraph"><p>A zero exit from the update hook allows the ref to be updated.
1028 Exiting with a non-zero status prevents
<code>git receive-pack
</code>
1029 from updating that ref.
</p></div>
1030 <div class=
"paragraph"><p>This hook can be used to prevent
<em>forced
</em> update on certain refs by
1031 making sure that the object name is a commit object that is a
1032 descendant of the commit object named by the old object name.
1033 That is, to enforce a
"fast-forward only" policy.
</p></div>
1034 <div class=
"paragraph"><p>It could also be used to log the old..new status. However, it
1035 does not know the entire set of branches, so it would end up
1036 firing one e-mail per ref when used naively, though. The
1037 <a href=
"#post-receive"><em>post-receive
</em></a> hook is more suited to that.
</p></div>
1038 <div class=
"paragraph"><p>In an environment that restricts the users' access only to git
1039 commands over the wire, this hook can be used to implement access
1040 control without relying on filesystem ownership and group
1041 membership. See
<a href=
"git-shell.html">git-shell(
1)
</a> for how you might use the login
1042 shell to restrict the user
’s access to only git commands.
</p></div>
1043 <div class=
"paragraph"><p>Both standard output and standard error output are forwarded to
1044 <code>git send-pack
</code> on the other end, so you can simply
<code>echo
</code> messages
1045 for the user.
</p></div>
1046 <div class=
"paragraph"><p>The default
<em>update
</em> hook, when enabled
—and with
1047 <code>hooks.allowunannotated
</code> config option unset or set to false
—prevents
1048 unannotated tags to be pushed.
</p></div>
1051 <h3 id=
"proc-receive">proc-receive
</h3>
1052 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-receive-pack.html">git-receive-pack(
1)
</a>. If the server has
1053 set the multi-valued config variable
<code>receive.procReceiveRefs
</code>, and the
1054 commands sent to
<em>receive-pack
</em> have matching reference names, these
1055 commands will be executed by this hook, instead of by the internal
1056 <code>execute_commands()
</code> function. This hook is responsible for updating
1057 the relevant references and reporting the results back to
<em>receive-pack
</em>.
</p></div>
1058 <div class=
"paragraph"><p>This hook executes once for the receive operation. It takes no
1059 arguments, but uses a pkt-line format protocol to communicate with
1060 <em>receive-pack
</em> to read commands, push-options and send results. In the
1061 following example for the protocol, the letter
<em>S
</em> stands for
1062 <em>receive-pack
</em> and the letter
<em>H
</em> stands for this hook.
</p></div>
1063 <div class=
"literalblock">
1064 <div class=
"content">
1065 <pre><code># Version and features negotiation.
1066 S: PKT-LINE(version=
1\
0push-options atomic...)
1068 H: PKT-LINE(version=
1\
0push-options...)
1069 H: flush-pkt
</code></pre>
1071 <div class=
"literalblock">
1072 <div class=
"content">
1073 <pre><code># Send commands from server to the hook.
1074 S: PKT-LINE(
<old-oid
> <new-oid
> <ref
>)
1077 # Send push-options only if the 'push-options' feature is enabled.
1078 S: PKT-LINE(push-option)
1080 S: flush-pkt
</code></pre>
1082 <div class=
"literalblock">
1083 <div class=
"content">
1084 <pre><code># Receive result from the hook.
1085 # OK, run this command successfully.
1086 H: PKT-LINE(ok
<ref
>)
1088 H: PKT-LINE(ng
<ref
> <reason
>)
1089 # Fall through, let 'receive-pack' to execute it.
1090 H: PKT-LINE(ok
<ref
>)
1091 H: PKT-LINE(option fall-through)
1092 # OK, but has an alternate reference. The alternate reference name
1093 # and other status can be given in option directives.
1094 H: PKT-LINE(ok
<ref
>)
1095 H: PKT-LINE(option refname
<refname
>)
1096 H: PKT-LINE(option old-oid
<old-oid
>)
1097 H: PKT-LINE(option new-oid
<new-oid
>)
1098 H: PKT-LINE(option forced-update)
1100 H: flush-pkt
</code></pre>
1102 <div class=
"paragraph"><p>Each command for the
<em>proc-receive
</em> hook may point to a pseudo-reference
1103 and always has a zero-old as its old-oid, while the
<em>proc-receive
</em> hook
1104 may update an alternate reference and the alternate reference may exist
1105 already with a non-zero old-oid. For this case, this hook will use
1106 "option" directives to report extended attributes for the reference given
1107 by the leading
"ok" directive.
</p></div>
1108 <div class=
"paragraph"><p>The report of the commands of this hook should have the same order as
1109 the input. The exit status of the
<em>proc-receive
</em> hook only determines
1110 the success or failure of the group of commands sent to it, unless
1111 atomic push is in use.
</p></div>
1114 <h3 id=
"post-receive">post-receive
</h3>
1115 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-receive-pack.html">git-receive-pack(
1)
</a> when it reacts to
1116 <code>git push
</code> and updates reference(s) in its repository.
1117 It executes on the remote repository once after all the refs have
1118 been updated.
</p></div>
1119 <div class=
"paragraph"><p>This hook executes once for the receive operation. It takes no
1120 arguments, but gets the same information as the
1121 <a href=
"#pre-receive"><em>pre-receive
</em></a>
1122 hook does on its standard input.
</p></div>
1123 <div class=
"paragraph"><p>This hook does not affect the outcome of
<code>git receive-pack
</code>, as it
1124 is called after the real work is done.
</p></div>
1125 <div class=
"paragraph"><p>This supersedes the
<a href=
"#post-update"><em>post-update
</em></a> hook in that it gets
1126 both old and new values of all the refs in addition to their
1128 <div class=
"paragraph"><p>Both standard output and standard error output are forwarded to
1129 <code>git send-pack
</code> on the other end, so you can simply
<code>echo
</code> messages
1130 for the user.
</p></div>
1131 <div class=
"paragraph"><p>The default
<em>post-receive
</em> hook is empty, but there is
1132 a sample script
<code>post-receive-email
</code> provided in the
<code>contrib/hooks
</code>
1133 directory in Git distribution, which implements sending commit
1135 <div class=
"paragraph"><p>The number of push options given on the command line of
1136 <code>git push --push-option=...
</code> can be read from the environment
1137 variable
<code>GIT_PUSH_OPTION_COUNT
</code>, and the options themselves are
1138 found in
<code>GIT_PUSH_OPTION_0
</code>,
<code>GIT_PUSH_OPTION_1
</code>,
…
1139 If it is negotiated to not use the push options phase, the
1140 environment variables will not be set. If the client selects
1141 to use push options, but doesn
’t transmit any, the count variable
1142 will be set to zero,
<code>GIT_PUSH_OPTION_COUNT=
0</code>.
</p></div>
1145 <h3 id=
"post-update">post-update
</h3>
1146 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-receive-pack.html">git-receive-pack(
1)
</a> when it reacts to
1147 <code>git push
</code> and updates reference(s) in its repository.
1148 It executes on the remote repository once after all the refs have
1149 been updated.
</p></div>
1150 <div class=
"paragraph"><p>It takes a variable number of parameters, each of which is the
1151 name of ref that was actually updated.
</p></div>
1152 <div class=
"paragraph"><p>This hook is meant primarily for notification, and cannot affect
1153 the outcome of
<code>git receive-pack
</code>.
</p></div>
1154 <div class=
"paragraph"><p>The
<em>post-update
</em> hook can tell what are the heads that were pushed,
1155 but it does not know what their original and updated values are,
1156 so it is a poor place to do log old..new. The
1157 <a href=
"#post-receive"><em>post-receive
</em></a> hook does get both original and
1158 updated values of the refs. You might consider it instead if you need
1160 <div class=
"paragraph"><p>When enabled, the default
<em>post-update
</em> hook runs
1161 <code>git update-server-info
</code> to keep the information used by dumb
1162 transports (e.g., HTTP) up to date. If you are publishing
1163 a Git repository that is accessible via HTTP, you should
1164 probably enable this hook.
</p></div>
1165 <div class=
"paragraph"><p>Both standard output and standard error output are forwarded to
1166 <code>git send-pack
</code> on the other end, so you can simply
<code>echo
</code> messages
1167 for the user.
</p></div>
1170 <h3 id=
"_reference_transaction">reference-transaction
</h3>
1171 <div class=
"paragraph"><p>This hook is invoked by any Git command that performs reference
1172 updates. It executes whenever a reference transaction is prepared,
1173 committed or aborted and may thus get called multiple times. The hook
1174 does not cover symbolic references (but that may change in the future).
</p></div>
1175 <div class=
"paragraph"><p>The hook takes exactly one argument, which is the current state the
1176 given reference transaction is in:
</p></div>
1177 <div class=
"ulist"><ul>
1180 "prepared": All reference updates have been queued to the
1181 transaction and references were locked on disk.
1186 "committed": The reference transaction was committed and all
1187 references now have their respective new value.
1192 "aborted": The reference transaction was aborted, no changes
1193 were performed and the locks have been released.
1197 <div class=
"paragraph"><p>For each reference update that was added to the transaction, the hook
1198 receives on standard input a line of the format:
</p></div>
1199 <div class=
"literalblock">
1200 <div class=
"content">
1201 <pre><code><old-value
> SP
<new-value
> SP
<ref-name
> LF
</code></pre>
1203 <div class=
"paragraph"><p>where
<code><old-value
></code> is the old object name passed into the reference
1204 transaction,
<code><new-value
></code> is the new object name to be stored in the
1205 ref and
<code><ref-name
></code> is the full name of the ref. When force updating
1206 the reference regardless of its current value or when the reference is
1207 to be created anew,
<code><old-value
></code> is the all-zeroes object name. To
1208 distinguish these cases, you can inspect the current value of
1209 <code><ref-name
></code> via
<code>git rev-parse
</code>.
</p></div>
1210 <div class=
"paragraph"><p>The exit status of the hook is ignored for any state except for the
1211 "prepared" state. In the
"prepared" state, a non-zero exit status will
1212 cause the transaction to be aborted. The hook will not be called with
1213 "aborted" state in that case.
</p></div>
1216 <h3 id=
"_push_to_checkout">push-to-checkout
</h3>
1217 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-receive-pack.html">git-receive-pack(
1)
</a> when it reacts to
1218 <code>git push
</code> and updates reference(s) in its repository, and when
1219 the push tries to update the branch that is currently checked out
1220 and the
<code>receive.denyCurrentBranch
</code> configuration variable is set to
1221 <code>updateInstead
</code>. Such a push by default is refused if the working
1222 tree and the index of the remote repository has any difference from
1223 the currently checked out commit; when both the working tree and the
1224 index match the current commit, they are updated to match the newly
1225 pushed tip of the branch. This hook is to be used to override the
1226 default behaviour.
</p></div>
1227 <div class=
"paragraph"><p>The hook receives the commit with which the tip of the current
1228 branch is going to be updated. It can exit with a non-zero status
1229 to refuse the push (when it does so, it must not modify the index or
1230 the working tree). Or it can make any necessary changes to the
1231 working tree and to the index to bring them to the desired state
1232 when the tip of the current branch is updated to the new commit, and
1233 exit with a zero status.
</p></div>
1234 <div class=
"paragraph"><p>For example, the hook can simply run
<code>git read-tree -u -m HEAD
"$1"</code>
1235 in order to emulate
<code>git fetch
</code> that is run in the reverse direction
1236 with
<code>git push
</code>, as the two-tree form of
<code>git read-tree -u -m
</code> is
1237 essentially the same as
<code>git switch
</code> or
<code>git checkout
</code>
1238 that switches branches while
1239 keeping the local changes in the working tree that do not interfere
1240 with the difference between the branches.
</p></div>
1243 <h3 id=
"_pre_auto_gc">pre-auto-gc
</h3>
1244 <div class=
"paragraph"><p>This hook is invoked by
<code>git gc --auto
</code> (see
<a href=
"git-gc.html">git-gc(
1)
</a>). It
1245 takes no parameter, and exiting with non-zero status from this script
1246 causes the
<code>git gc --auto
</code> to abort.
</p></div>
1249 <h3 id=
"_post_rewrite">post-rewrite
</h3>
1250 <div class=
"paragraph"><p>This hook is invoked by commands that rewrite commits
1251 (
<a href=
"git-commit.html">git-commit(
1)
</a> when called with
<code>--amend
</code> and
1252 <a href=
"git-rebase.html">git-rebase(
1)
</a>; however, full-history (re)writing tools like
1253 <a href=
"git-fast-import.html">git-fast-import(
1)
</a> or
1254 <a href=
"https://github.com/newren/git-filter-repo">git-filter-repo
</a> typically
1255 do not call it!). Its first argument denotes the command it was
1256 invoked by: currently one of
<code>amend
</code> or
<code>rebase
</code>. Further
1257 command-dependent arguments may be passed in the future.
</p></div>
1258 <div class=
"paragraph"><p>The hook receives a list of the rewritten commits on stdin, in the
1260 <div class=
"literalblock">
1261 <div class=
"content">
1262 <pre><code><old-object-name
> SP
<new-object-name
> [ SP
<extra-info
> ] LF
</code></pre>
1264 <div class=
"paragraph"><p>The
<em>extra-info
</em> is again command-dependent. If it is empty, the
1265 preceding SP is also omitted. Currently, no commands pass any
1266 <em>extra-info
</em>.
</p></div>
1267 <div class=
"paragraph"><p>The hook always runs after the automatic note copying (see
1268 "notes.rewrite.<command>" in
<a href=
"git-config.html">git-config(
1)
</a>) has happened, and
1269 thus has access to these notes.
</p></div>
1270 <div class=
"paragraph"><p>The following command-specific comments apply:
</p></div>
1271 <div class=
"dlist"><dl>
1272 <dt class=
"hdlist1">
1277 For the
<em>squash
</em> and
<em>fixup
</em> operation, all commits that were
1278 squashed are listed as being rewritten to the squashed commit.
1279 This means that there will be several lines sharing the same
1280 <em>new-object-name
</em>.
1282 <div class=
"paragraph"><p>The commits are guaranteed to be listed in the order that they were
1283 processed by rebase.
</p></div>
1288 <h3 id=
"_sendemail_validate">sendemail-validate
</h3>
1289 <div class=
"paragraph"><p>This hook is invoked by
<a href=
"git-send-email.html">git-send-email(
1)
</a>.
</p></div>
1290 <div class=
"paragraph"><p>It takes these command line arguments. They are,
1291 1. the name of the file which holds the contents of the email to be sent.
1292 2. The name of the file which holds the SMTP headers of the email.
</p></div>
1293 <div class=
"paragraph"><p>The SMTP headers are passed in the exact same way as they are passed to the
1294 user
’s Mail Transport Agent (MTA). In effect, the email given to the user
’s
1295 MTA, is the contents of $
2 followed by the contents of $
1.
</p></div>
1296 <div class=
"paragraph"><p>An example of a few common headers is shown below. Take notice of the
1297 capitalization and multi-line tab structure.
</p></div>
1298 <div class=
"literalblock">
1299 <div class=
"content">
1300 <pre><code>From: Example
<from@example.com
>
1303 A
<author@example.com
>,
1304 One
<one@example.com
>,
1306 Subject: PATCH-STRING
</code></pre>
1308 <div class=
"paragraph"><p>Exiting with a non-zero status causes
<code>git send-email
</code> to abort
1309 before sending any e-mails.
</p></div>
1310 <div class=
"paragraph"><p>The following environment variables are set when executing the hook.
</p></div>
1311 <div class=
"dlist"><dl>
1312 <dt class=
"hdlist1">
1313 <code>GIT_SENDEMAIL_FILE_COUNTER
</code>
1317 A
1-based counter incremented by one for every file holding an e-mail
1318 to be sent (excluding any FIFOs). This counter does not follow the
1319 patch series counter scheme. It will always start at
1 and will end at
1320 GIT_SENDEMAIL_FILE_TOTAL.
1323 <dt class=
"hdlist1">
1324 <code>GIT_SENDEMAIL_FILE_TOTAL
</code>
1328 The total number of files that will be sent (excluding any FIFOs). This
1329 counter does not follow the patch series counter scheme. It will always
1330 be equal to the number of files being sent, whether there is a cover
1335 <div class=
"paragraph"><p>These variables may for instance be used to validate patch series.
</p></div>
1336 <div class=
"paragraph"><p>The sample
<code>sendemail-validate
</code> hook that comes with Git checks that all sent
1337 patches (excluding the cover letter) can be applied on top of the upstream
1338 repository default branch without conflicts. Some placeholders are left for
1339 additional validation steps to be performed after all patches of a given series
1340 have been applied.
</p></div>
1343 <h3 id=
"_fsmonitor_watchman">fsmonitor-watchman
</h3>
1344 <div class=
"paragraph"><p>This hook is invoked when the configuration option
<code>core.fsmonitor
</code> is
1345 set to
<code>.git/hooks/fsmonitor-watchman
</code> or
<code>.git/hooks/fsmonitor-watchmanv2
</code>
1346 depending on the version of the hook to use.
</p></div>
1347 <div class=
"paragraph"><p>Version
1 takes two arguments, a version (
1) and the time in elapsed
1348 nanoseconds since midnight, January
1,
1970.
</p></div>
1349 <div class=
"paragraph"><p>Version
2 takes two arguments, a version (
2) and a token that is used
1350 for identifying changes since the token. For watchman this would be
1351 a clock id. This version must output to stdout the new token followed
1352 by a NUL before the list of files.
</p></div>
1353 <div class=
"paragraph"><p>The hook should output to stdout the list of all files in the working
1354 directory that may have changed since the requested time. The logic
1355 should be inclusive so that it does not miss any potential changes.
1356 The paths should be relative to the root of the working directory
1357 and be separated by a single NUL.
</p></div>
1358 <div class=
"paragraph"><p>It is OK to include files which have not actually changed. All changes
1359 including newly-created and deleted files should be included. When
1360 files are renamed, both the old and the new name should be included.
</p></div>
1361 <div class=
"paragraph"><p>Git will limit what files it checks for changes as well as which
1362 directories are checked for untracked files based on the path names
1364 <div class=
"paragraph"><p>An optimized way to tell git
"all files have changed" is to return
1365 the filename
<code>/
</code>.
</p></div>
1366 <div class=
"paragraph"><p>The exit status determines whether git will use the data from the
1367 hook to limit its search. On error, it will fall back to verifying
1368 all files and folders.
</p></div>
1371 <h3 id=
"_p4_changelist">p4-changelist
</h3>
1372 <div class=
"paragraph"><p>This hook is invoked by
<code>git-p4 submit
</code>.
</p></div>
1373 <div class=
"paragraph"><p>The
<code>p4-changelist
</code> hook is executed after the changelist
1374 message has been edited by the user. It can be bypassed with the
1375 <code>--no-verify
</code> option. It takes a single parameter, the name
1376 of the file that holds the proposed changelist text. Exiting
1377 with a non-zero status causes the command to abort.
</p></div>
1378 <div class=
"paragraph"><p>The hook is allowed to edit the changelist file and can be used
1379 to normalize the text into some project standard format. It can
1380 also be used to refuse the Submit after inspect the message file.
</p></div>
1381 <div class=
"paragraph"><p>Run
<code>git-p4 submit --help
</code> for details.
</p></div>
1384 <h3 id=
"_p4_prepare_changelist">p4-prepare-changelist
</h3>
1385 <div class=
"paragraph"><p>This hook is invoked by
<code>git-p4 submit
</code>.
</p></div>
1386 <div class=
"paragraph"><p>The
<code>p4-prepare-changelist
</code> hook is executed right after preparing
1387 the default changelist message and before the editor is started.
1388 It takes one parameter, the name of the file that contains the
1389 changelist text. Exiting with a non-zero status from the script
1390 will abort the process.
</p></div>
1391 <div class=
"paragraph"><p>The purpose of the hook is to edit the message file in place,
1392 and it is not suppressed by the
<code>--no-verify
</code> option. This hook
1393 is called even if
<code>--prepare-p4-only
</code> is set.
</p></div>
1394 <div class=
"paragraph"><p>Run
<code>git-p4 submit --help
</code> for details.
</p></div>
1397 <h3 id=
"_p4_post_changelist">p4-post-changelist
</h3>
1398 <div class=
"paragraph"><p>This hook is invoked by
<code>git-p4 submit
</code>.
</p></div>
1399 <div class=
"paragraph"><p>The
<code>p4-post-changelist
</code> hook is invoked after the submit has
1400 successfully occurred in P4. It takes no parameters and is meant
1401 primarily for notification and cannot affect the outcome of the
1402 git p4 submit action.
</p></div>
1403 <div class=
"paragraph"><p>Run
<code>git-p4 submit --help
</code> for details.
</p></div>
1406 <h3 id=
"_p4_pre_submit">p4-pre-submit
</h3>
1407 <div class=
"paragraph"><p>This hook is invoked by
<code>git-p4 submit
</code>. It takes no parameters and nothing
1408 from standard input. Exiting with non-zero status from this script prevent
1409 <code>git-p4 submit
</code> from launching. It can be bypassed with the
<code>--no-verify
</code>
1410 command line option. Run
<code>git-p4 submit --help
</code> for details.
</p></div>
1413 <h3 id=
"_post_index_change">post-index-change
</h3>
1414 <div class=
"paragraph"><p>This hook is invoked when the index is written in read-cache.c
1415 do_write_locked_index.
</p></div>
1416 <div class=
"paragraph"><p>The first parameter passed to the hook is the indicator for the
1417 working directory being updated.
"1" meaning working directory
1418 was updated or
"0" when the working directory was not updated.
</p></div>
1419 <div class=
"paragraph"><p>The second parameter passed to the hook is the indicator for whether
1420 or not the index was updated and the skip-worktree bit could have
1421 changed.
"1" meaning skip-worktree bits could have been updated
1422 and
"0" meaning they were not.
</p></div>
1423 <div class=
"paragraph"><p>Only one parameter should be set to
"1" when the hook runs. The hook
1424 running passing
"1",
"1" should not be possible.
</p></div>
1429 <h2 id=
"_see_also">SEE ALSO
</h2>
1430 <div class=
"sectionbody">
1431 <div class=
"paragraph"><p><a href=
"git-hook.html">git-hook(
1)
</a></p></div>
1435 <h2 id=
"_git">GIT
</h2>
1436 <div class=
"sectionbody">
1437 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1441 <div id=
"footnotes"><hr /></div>
1443 <div id=
"footer-text">
1445 2023-
05-
10 11:
57:
07 PDT