Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
| 2 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 8.4.5" /> |
| 7 | <title>githooks(5)</title> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 8 | <style type="text/css"> |
| 9 | /* Debug borders */ |
| 10 | p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { |
| 11 | /* |
| 12 | border: 1px solid red; |
| 13 | */ |
| 14 | } |
| 15 | |
| 16 | body { |
| 17 | margin: 1em 5% 1em 5%; |
| 18 | } |
| 19 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 20 | a { |
| 21 | color: blue; |
| 22 | text-decoration: underline; |
| 23 | } |
| 24 | a:visited { |
| 25 | color: fuchsia; |
| 26 | } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 27 | |
| 28 | em { |
| 29 | font-style: italic; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 30 | color: navy; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | strong { |
| 34 | font-weight: bold; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 35 | color: #083194; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | tt { |
| 39 | color: navy; |
| 40 | } |
| 41 | |
| 42 | h1, h2, h3, h4, h5, h6 { |
| 43 | color: #527bbd; |
| 44 | font-family: sans-serif; |
| 45 | margin-top: 1.2em; |
| 46 | margin-bottom: 0.5em; |
| 47 | line-height: 1.3; |
| 48 | } |
| 49 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 50 | h1, h2, h3 { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 51 | border-bottom: 2px solid silver; |
| 52 | } |
| 53 | h2 { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 54 | padding-top: 0.5em; |
| 55 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 56 | h3 { |
| 57 | float: left; |
| 58 | } |
| 59 | h3 + * { |
| 60 | clear: left; |
| 61 | } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 62 | |
| 63 | div.sectionbody { |
| 64 | font-family: serif; |
| 65 | margin-left: 0; |
| 66 | } |
| 67 | |
| 68 | hr { |
| 69 | border: 1px solid silver; |
| 70 | } |
| 71 | |
| 72 | p { |
| 73 | margin-top: 0.5em; |
| 74 | margin-bottom: 0.5em; |
| 75 | } |
| 76 | |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 77 | ul, ol, li > p { |
| 78 | margin-top: 0; |
| 79 | } |
| 80 | |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 81 | pre { |
| 82 | padding: 0; |
| 83 | margin: 0; |
| 84 | } |
| 85 | |
| 86 | span#author { |
| 87 | color: #527bbd; |
| 88 | font-family: sans-serif; |
| 89 | font-weight: bold; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 90 | font-size: 1.1em; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 91 | } |
| 92 | span#email { |
| 93 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 94 | span#revnumber, span#revdate, span#revremark { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 95 | font-family: sans-serif; |
| 96 | } |
| 97 | |
| 98 | div#footer { |
| 99 | font-family: sans-serif; |
| 100 | font-size: small; |
| 101 | border-top: 2px solid silver; |
| 102 | padding-top: 0.5em; |
| 103 | margin-top: 4.0em; |
| 104 | } |
| 105 | div#footer-text { |
| 106 | float: left; |
| 107 | padding-bottom: 0.5em; |
| 108 | } |
| 109 | div#footer-badges { |
| 110 | float: right; |
| 111 | padding-bottom: 0.5em; |
| 112 | } |
| 113 | |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 114 | div#preamble { |
| 115 | margin-top: 1.5em; |
| 116 | margin-bottom: 1.5em; |
| 117 | } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 118 | div.tableblock, div.imageblock, div.exampleblock, div.verseblock, |
| 119 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 120 | div.admonitionblock { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 121 | margin-top: 1.5em; |
| 122 | margin-bottom: 1.5em; |
| 123 | } |
| 124 | div.admonitionblock { |
| 125 | margin-top: 2.5em; |
| 126 | margin-bottom: 2.5em; |
| 127 | } |
| 128 | |
| 129 | div.content { /* Block element content. */ |
| 130 | padding: 0; |
| 131 | } |
| 132 | |
| 133 | /* Block element titles. */ |
| 134 | div.title, caption.title { |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 135 | color: #527bbd; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 136 | font-family: sans-serif; |
| 137 | font-weight: bold; |
| 138 | text-align: left; |
| 139 | margin-top: 1.0em; |
| 140 | margin-bottom: 0.5em; |
| 141 | } |
| 142 | div.title + * { |
| 143 | margin-top: 0; |
| 144 | } |
| 145 | |
| 146 | td div.title:first-child { |
| 147 | margin-top: 0.0em; |
| 148 | } |
| 149 | div.content div.title:first-child { |
| 150 | margin-top: 0.0em; |
| 151 | } |
| 152 | div.content + div.title { |
| 153 | margin-top: 0.0em; |
| 154 | } |
| 155 | |
| 156 | div.sidebarblock > div.content { |
| 157 | background: #ffffee; |
| 158 | border: 1px solid silver; |
| 159 | padding: 0.5em; |
| 160 | } |
| 161 | |
| 162 | div.listingblock > div.content { |
| 163 | border: 1px solid silver; |
| 164 | background: #f4f4f4; |
| 165 | padding: 0.5em; |
| 166 | } |
| 167 | |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 168 | div.quoteblock { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 169 | padding-left: 2.0em; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 170 | margin-right: 10%; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 171 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 172 | div.quoteblock > div.attribution { |
| 173 | padding-top: 0.5em; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 174 | text-align: right; |
| 175 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 176 | |
| 177 | div.verseblock { |
| 178 | padding-left: 2.0em; |
| 179 | margin-right: 10%; |
| 180 | } |
| 181 | div.verseblock > div.content { |
| 182 | white-space: pre; |
| 183 | } |
| 184 | div.verseblock > div.attribution { |
| 185 | padding-top: 0.75em; |
| 186 | text-align: left; |
| 187 | } |
| 188 | /* DEPRECATED: Pre version 8.2.7 verse style literal block. */ |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 189 | div.verseblock + div.attribution { |
| 190 | text-align: left; |
| 191 | } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 192 | |
| 193 | div.admonitionblock .icon { |
| 194 | vertical-align: top; |
| 195 | font-size: 1.1em; |
| 196 | font-weight: bold; |
| 197 | text-decoration: underline; |
| 198 | color: #527bbd; |
| 199 | padding-right: 0.5em; |
| 200 | } |
| 201 | div.admonitionblock td.content { |
| 202 | padding-left: 0.5em; |
| 203 | border-left: 2px solid silver; |
| 204 | } |
| 205 | |
| 206 | div.exampleblock > div.content { |
| 207 | border-left: 2px solid silver; |
| 208 | padding: 0.5em; |
| 209 | } |
| 210 | |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 211 | div.imageblock div.content { padding-left: 0; } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 212 | span.image img { border-style: none; } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 213 | a.image:visited { color: white; } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 214 | |
| 215 | dl { |
| 216 | margin-top: 0.8em; |
| 217 | margin-bottom: 0.8em; |
| 218 | } |
| 219 | dt { |
| 220 | margin-top: 0.5em; |
| 221 | margin-bottom: 0; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 222 | font-style: normal; |
| 223 | color: navy; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 224 | } |
| 225 | dd > *:first-child { |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 226 | margin-top: 0.1em; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | ul, ol { |
| 230 | list-style-position: outside; |
| 231 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 232 | ol.arabic { |
| 233 | list-style-type: decimal; |
| 234 | } |
| 235 | ol.loweralpha { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 236 | list-style-type: lower-alpha; |
| 237 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 238 | ol.upperalpha { |
| 239 | list-style-type: upper-alpha; |
| 240 | } |
| 241 | ol.lowerroman { |
| 242 | list-style-type: lower-roman; |
| 243 | } |
| 244 | ol.upperroman { |
| 245 | list-style-type: upper-roman; |
| 246 | } |
| 247 | |
| 248 | div.compact ul, div.compact ol, |
| 249 | div.compact p, div.compact p, |
| 250 | div.compact div, div.compact div { |
| 251 | margin-top: 0.1em; |
| 252 | margin-bottom: 0.1em; |
| 253 | } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 254 | |
| 255 | div.tableblock > table { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 256 | border: 3px solid #527bbd; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 257 | } |
| 258 | thead { |
| 259 | font-family: sans-serif; |
| 260 | font-weight: bold; |
| 261 | } |
| 262 | tfoot { |
| 263 | font-weight: bold; |
| 264 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 265 | td > div.verse { |
| 266 | white-space: pre; |
| 267 | } |
| 268 | p.table { |
| 269 | margin-top: 0; |
| 270 | } |
| 271 | /* Because the table frame attribute is overriden by CSS in most browsers. */ |
| 272 | div.tableblock > table[frame="void"] { |
| 273 | border-style: none; |
| 274 | } |
| 275 | div.tableblock > table[frame="hsides"] { |
| 276 | border-left-style: none; |
| 277 | border-right-style: none; |
| 278 | } |
| 279 | div.tableblock > table[frame="vsides"] { |
| 280 | border-top-style: none; |
| 281 | border-bottom-style: none; |
| 282 | } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 283 | |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 284 | |
| 285 | div.hdlist { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 286 | margin-top: 0.8em; |
| 287 | margin-bottom: 0.8em; |
| 288 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 289 | div.hdlist tr { |
| 290 | padding-bottom: 15px; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 291 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 292 | dt.hdlist1.strong, td.hdlist1.strong { |
| 293 | font-weight: bold; |
| 294 | } |
| 295 | td.hdlist1 { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 296 | vertical-align: top; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 297 | font-style: normal; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 298 | padding-right: 0.8em; |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 299 | color: navy; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 300 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 301 | td.hdlist2 { |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 302 | vertical-align: top; |
| 303 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 304 | div.hdlist.compact tr { |
| 305 | margin: 0; |
| 306 | padding-bottom: 0; |
| 307 | } |
| 308 | |
| 309 | .comment { |
| 310 | background: yellow; |
| 311 | } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 312 | |
| 313 | @media print { |
| 314 | div#footer-badges { display: none; } |
| 315 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 316 | |
| 317 | div#toctitle { |
| 318 | color: #527bbd; |
| 319 | font-family: sans-serif; |
| 320 | font-size: 1.1em; |
| 321 | font-weight: bold; |
| 322 | margin-top: 1.0em; |
| 323 | margin-bottom: 0.1em; |
| 324 | } |
| 325 | |
| 326 | div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { |
| 327 | margin-top: 0; |
| 328 | margin-bottom: 0; |
| 329 | } |
| 330 | div.toclevel2 { |
| 331 | margin-left: 2em; |
| 332 | font-size: 0.9em; |
| 333 | } |
| 334 | div.toclevel3 { |
| 335 | margin-left: 4em; |
| 336 | font-size: 0.9em; |
| 337 | } |
| 338 | div.toclevel4 { |
| 339 | margin-left: 6em; |
| 340 | font-size: 0.9em; |
| 341 | } |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 342 | /* Overrides for manpage documents */ |
| 343 | h1 { |
| 344 | padding-top: 0.5em; |
| 345 | padding-bottom: 0.5em; |
| 346 | border-top: 2px solid silver; |
| 347 | border-bottom: 2px solid silver; |
| 348 | } |
| 349 | h2 { |
| 350 | border-style: none; |
| 351 | } |
| 352 | div.sectionbody { |
| 353 | margin-left: 5%; |
| 354 | } |
| 355 | |
| 356 | @media print { |
| 357 | div#toc { display: none; } |
| 358 | } |
| 359 | |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 360 | /* Workarounds for IE6's broken and incomplete CSS2. */ |
| 361 | |
| 362 | div.sidebar-content { |
| 363 | background: #ffffee; |
| 364 | border: 1px solid silver; |
| 365 | padding: 0.5em; |
| 366 | } |
| 367 | div.sidebar-title, div.image-title { |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 368 | color: #527bbd; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 369 | font-family: sans-serif; |
| 370 | font-weight: bold; |
| 371 | margin-top: 0.0em; |
| 372 | margin-bottom: 0.5em; |
| 373 | } |
| 374 | |
| 375 | div.listingblock div.content { |
| 376 | border: 1px solid silver; |
| 377 | background: #f4f4f4; |
| 378 | padding: 0.5em; |
| 379 | } |
| 380 | |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 381 | div.quoteblock-attribution { |
| 382 | padding-top: 0.5em; |
| 383 | text-align: right; |
| 384 | } |
| 385 | |
| 386 | div.verseblock-content { |
| 387 | white-space: pre; |
| 388 | } |
| 389 | div.verseblock-attribution { |
| 390 | padding-top: 0.75em; |
| 391 | text-align: left; |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 392 | } |
| 393 | |
| 394 | div.exampleblock-content { |
| 395 | border-left: 2px solid silver; |
| 396 | padding-left: 0.5em; |
| 397 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 398 | |
| 399 | /* IE6 sets dynamically generated links as visited. */ |
| 400 | div#toc a:visited { color: blue; } |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 401 | </style> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 402 | </head> |
| 403 | <body> |
| 404 | <div id="header"> |
| 405 | <h1> |
| 406 | githooks(5) Manual Page |
| 407 | </h1> |
| 408 | <h2>NAME</h2> |
| 409 | <div class="sectionbody"> |
| 410 | <p>githooks - |
| 411 | Hooks used by git |
| 412 | </p> |
| 413 | </div> |
| 414 | </div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 415 | <h2 id="_synopsis">SYNOPSIS</h2> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 416 | <div class="sectionbody"> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 417 | <div class="paragraph"><p>$GIT_DIR/hooks/*</p></div> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 418 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 419 | <h2 id="_description">DESCRIPTION</h2> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 420 | <div class="sectionbody"> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 421 | <div class="paragraph"><p>Hooks are little scripts you can place in <tt>$GIT_DIR/hooks</tt> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 422 | directory to trigger action at certain points. When |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 423 | <em>git init</em> is run, a handful of example hooks are copied into the |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 424 | <tt>hooks</tt> directory of the new repository, but by default they are |
Junio C Hamano | 6aff399 | 2008-06-25 08:07:44 | [diff] [blame] | 425 | all disabled. To enable a hook, rename it by removing its <tt>.sample</tt> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 426 | suffix.</p></div> |
Junio C Hamano | 8a48fa2 | 2008-12-18 08:44:30 | [diff] [blame] | 427 | <div class="admonitionblock"> |
| 428 | <table><tr> |
| 429 | <td class="icon"> |
| 430 | <div class="title">Note</div> |
| 431 | </td> |
| 432 | <td class="content">It is also a requirement for a given hook to be executable. |
| 433 | However - in a freshly initialized repository - the <tt>.sample</tt> files are |
| 434 | executable by default.</td> |
| 435 | </tr></table> |
| 436 | </div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 437 | <div class="paragraph"><p>This document describes the currently defined hooks.</p></div> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 438 | </div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 439 | <h2 id="_hooks">HOOKS</h2> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 440 | <div class="sectionbody"> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 441 | <h3 id="_applypatch_msg">applypatch-msg</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 442 | <div class="paragraph"><p>This hook is invoked by <em>git am</em> script. It takes a single |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 443 | parameter, the name of the file that holds the proposed commit |
| 444 | log message. Exiting with non-zero status causes |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 445 | <em>git am</em> to abort before applying the patch.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 446 | <div class="paragraph"><p>The hook is allowed to edit the message file in place, and can |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 447 | be used to normalize the message into some project standard |
| 448 | format (if the project has one). It can also be used to refuse |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 449 | the commit after inspecting the message file.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 450 | <div class="paragraph"><p>The default <em>applypatch-msg</em> hook, when enabled, runs the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 451 | <em>commit-msg</em> hook, if the latter is enabled.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 452 | <h3 id="_pre_applypatch">pre-applypatch</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 453 | <div class="paragraph"><p>This hook is invoked by <em>git am</em>. It takes no parameter, and is |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 454 | invoked after the patch is applied, but before a commit is made.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 455 | <div class="paragraph"><p>If it exits with non-zero status, then the working tree will not be |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 456 | committed after applying the patch.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 457 | <div class="paragraph"><p>It can be used to inspect the current working tree and refuse to |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 458 | make a commit if it does not pass certain test.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 459 | <div class="paragraph"><p>The default <em>pre-applypatch</em> hook, when enabled, runs the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 460 | <em>pre-commit</em> hook, if the latter is enabled.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 461 | <h3 id="_post_applypatch">post-applypatch</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 462 | <div class="paragraph"><p>This hook is invoked by <em>git am</em>. It takes no parameter, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 463 | and is invoked after the patch is applied and a commit is made.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 464 | <div class="paragraph"><p>This hook is meant primarily for notification, and cannot affect |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 465 | the outcome of <em>git am</em>.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 466 | <h3 id="_pre_commit">pre-commit</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 467 | <div class="paragraph"><p>This hook is invoked by <em>git commit</em>, and can be bypassed |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 468 | with <tt>--no-verify</tt> option. It takes no parameter, and is |
| 469 | invoked before obtaining the proposed commit log message and |
| 470 | making a commit. Exiting with non-zero status from this script |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 471 | causes the <em>git commit</em> to abort.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 472 | <div class="paragraph"><p>The default <em>pre-commit</em> hook, when enabled, catches introduction |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 473 | of lines with trailing whitespaces and aborts the commit when |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 474 | such a line is found.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 475 | <div class="paragraph"><p>All the <em>git commit</em> hooks are invoked with the environment |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 476 | variable <tt>GIT_EDITOR=:</tt> if the command will not bring up an editor |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 477 | to modify the commit message.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 478 | <h3 id="_prepare_commit_msg">prepare-commit-msg</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 479 | <div class="paragraph"><p>This hook is invoked by <em>git commit</em> right after preparing the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 480 | default log message, and before the editor is started.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 481 | <div class="paragraph"><p>It takes one to three parameters. The first is the name of the file |
Junio C Hamano | bd53dbf | 2009-01-18 18:26:37 | [diff] [blame] | 482 | that contains the commit log message. The second is the source of the commit |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 483 | message, and can be: <tt>message</tt> (if a <tt>-m</tt> or <tt>-F</tt> option was |
| 484 | given); <tt>template</tt> (if a <tt>-t</tt> option was given or the |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 485 | configuration option <tt>commit.template</tt> is set); <tt>merge</tt> (if the |
| 486 | commit is a merge or a <tt>.git/MERGE_MSG</tt> file exists); <tt>squash</tt> |
| 487 | (if a <tt>.git/SQUASH_MSG</tt> file exists); or <tt>commit</tt>, followed by |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 488 | a commit SHA1 (if a <tt>-c</tt>, <tt>-C</tt> or <tt>--amend</tt> option was given).</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 489 | <div class="paragraph"><p>If the exit status is non-zero, <em>git commit</em> will abort.</p></div> |
| 490 | <div class="paragraph"><p>The purpose of the hook is to edit the message file in place, and |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 491 | it is not suppressed by the <tt>--no-verify</tt> option. A non-zero exit |
| 492 | means a failure of the hook and aborts the commit. It should not |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 493 | be used as replacement for pre-commit hook.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 494 | <div class="paragraph"><p>The sample <tt>prepare-commit-msg</tt> hook that comes with git comments |
| 495 | out the <tt>Conflicts:</tt> part of a merge’s commit message.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 496 | <h3 id="_commit_msg">commit-msg</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 497 | <div class="paragraph"><p>This hook is invoked by <em>git commit</em>, and can be bypassed |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 498 | with <tt>--no-verify</tt> option. It takes a single parameter, the |
| 499 | name of the file that holds the proposed commit log message. |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 500 | Exiting with non-zero status causes the <em>git commit</em> to |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 501 | abort.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 502 | <div class="paragraph"><p>The hook is allowed to edit the message file in place, and can |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 503 | be used to normalize the message into some project standard |
| 504 | format (if the project has one). It can also be used to refuse |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 505 | the commit after inspecting the message file.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 506 | <div class="paragraph"><p>The default <em>commit-msg</em> hook, when enabled, detects duplicate |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 507 | "Signed-off-by" lines, and aborts the commit if one is found.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 508 | <h3 id="_post_commit">post-commit</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 509 | <div class="paragraph"><p>This hook is invoked by <em>git commit</em>. It takes no |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 510 | parameter, and is invoked after a commit is made.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 511 | <div class="paragraph"><p>This hook is meant primarily for notification, and cannot affect |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 512 | the outcome of <em>git commit</em>.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 513 | <h3 id="_pre_rebase">pre-rebase</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 514 | <div class="paragraph"><p>This hook is called by <em>git rebase</em> and can be used to prevent a branch |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 515 | from getting rebased.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 516 | <h3 id="_post_checkout">post-checkout</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 517 | <div class="paragraph"><p>This hook is invoked when a <em>git checkout</em> is run after having updated the |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 518 | worktree. The hook is given three parameters: the ref of the previous HEAD, |
| 519 | the ref of the new HEAD (which may or may not have changed), and a flag |
| 520 | indicating whether the checkout was a branch checkout (changing branches, |
| 521 | flag=1) or a file checkout (retrieving a file from the index, flag=0). |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 522 | This hook cannot affect the outcome of <em>git checkout</em>.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 523 | <div class="paragraph"><p>It is also run after <em>git clone</em>, unless the --no-checkout (-n) option is |
Junio C Hamano | 36a5672 | 2009-03-28 08:55:34 | [diff] [blame] | 524 | used. The first parameter given to the hook is the null-ref, the second the |
| 525 | ref of the new HEAD and the flag is always 1.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 526 | <div class="paragraph"><p>This hook can be used to perform repository validity checks, auto-display |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 527 | differences from the previous HEAD if different, or set working dir metadata |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 528 | properties.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 529 | <h3 id="_post_merge">post-merge</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 530 | <div class="paragraph"><p>This hook is invoked by <em>git merge</em>, which happens when a <em>git pull</em> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 531 | is done on a local repository. The hook takes a single parameter, a status |
| 532 | flag specifying whether or not the merge being done was a squash merge. |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 533 | This hook cannot affect the outcome of <em>git merge</em> and is not executed, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 534 | if the merge failed due to conflicts.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 535 | <div class="paragraph"><p>This hook can be used in conjunction with a corresponding pre-commit hook to |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 536 | save and restore any form of metadata associated with the working tree |
| 537 | (eg: permissions/ownership, ACLS, etc). See contrib/hooks/setgitperms.perl |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 538 | for an example of how to do this.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 539 | <h3 id="pre-receive">pre-receive</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 540 | <div class="paragraph"><p>This hook is invoked by <em>git-receive-pack</em> on the remote repository, |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 541 | which happens when a <em>git push</em> is done on a local repository. |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 542 | Just before starting to update refs on the remote repository, the |
| 543 | pre-receive hook is invoked. Its exit status determines the success |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 544 | or failure of the update.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 545 | <div class="paragraph"><p>This hook executes once for the receive operation. It takes no |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 546 | arguments, but for each ref to be updated it receives on standard |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 547 | input a line of the format:</p></div> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 548 | <div class="literalblock"> |
| 549 | <div class="content"> |
| 550 | <pre><tt><old-value> SP <new-value> SP <ref-name> LF</tt></pre> |
| 551 | </div></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 552 | <div class="paragraph"><p>where <tt><old-value></tt> is the old object name stored in the ref, |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 553 | <tt><new-value></tt> is the new object name to be stored in the ref and |
| 554 | <tt><ref-name></tt> is the full name of the ref. |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 555 | When creating a new ref, <tt><old-value></tt> is 40 <tt>0</tt>.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 556 | <div class="paragraph"><p>If the hook exits with non-zero status, none of the refs will be |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 557 | updated. If the hook exits with zero, updating of individual refs can |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 558 | still be prevented by the <a href="#update"><em>update</em></a> hook.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 559 | <div class="paragraph"><p>Both standard output and standard error output are forwarded to |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 560 | <em>git send-pack</em> on the other end, so you can simply <tt>echo</tt> messages |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 561 | for the user.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 562 | <h3 id="update">update</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 563 | <div class="paragraph"><p>This hook is invoked by <em>git-receive-pack</em> on the remote repository, |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 564 | which happens when a <em>git push</em> is done on a local repository. |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 565 | Just before updating the ref on the remote repository, the update hook |
| 566 | is invoked. Its exit status determines the success or failure of |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 567 | the ref update.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 568 | <div class="paragraph"><p>The hook executes once for each ref to be updated, and takes |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 569 | three parameters:</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 570 | <div class="ulist"><ul> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 571 | <li> |
| 572 | <p> |
| 573 | the name of the ref being updated, |
| 574 | </p> |
| 575 | </li> |
| 576 | <li> |
| 577 | <p> |
| 578 | the old object name stored in the ref, |
| 579 | </p> |
| 580 | </li> |
| 581 | <li> |
| 582 | <p> |
| 583 | and the new objectname to be stored in the ref. |
| 584 | </p> |
| 585 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 586 | </ul></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 587 | <div class="paragraph"><p>A zero exit from the update hook allows the ref to be updated. |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 588 | Exiting with a non-zero status prevents <em>git-receive-pack</em> |
| 589 | from updating that ref.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 590 | <div class="paragraph"><p>This hook can be used to prevent <em>forced</em> update on certain refs by |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 591 | making sure that the object name is a commit object that is a |
| 592 | descendant of the commit object named by the old object name. |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame] | 593 | That is, to enforce a "fast-forward only" policy.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 594 | <div class="paragraph"><p>It could also be used to log the old..new status. However, it |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 595 | does not know the entire set of branches, so it would end up |
| 596 | firing one e-mail per ref when used naively, though. The |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 597 | <a href="#post-receive"><em>post-receive</em></a> hook is more suited to that.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 598 | <div class="paragraph"><p>Another use suggested on the mailing list is to use this hook to |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 599 | implement access control which is finer grained than the one |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 600 | based on filesystem group.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 601 | <div class="paragraph"><p>Both standard output and standard error output are forwarded to |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 602 | <em>git send-pack</em> on the other end, so you can simply <tt>echo</tt> messages |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 603 | for the user.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 604 | <div class="paragraph"><p>The default <em>update</em> hook, when enabled—and with |
| 605 | <tt>hooks.allowunannotated</tt> config option unset or set to false—prevents |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 606 | unannotated tags to be pushed.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 607 | <h3 id="post-receive">post-receive</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 608 | <div class="paragraph"><p>This hook is invoked by <em>git-receive-pack</em> on the remote repository, |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 609 | which happens when a <em>git push</em> is done on a local repository. |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 610 | It executes on the remote repository once after all the refs have |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 611 | been updated.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 612 | <div class="paragraph"><p>This hook executes once for the receive operation. It takes no |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 613 | arguments, but gets the same information as the |
| 614 | <a href="#pre-receive"><em>pre-receive</em></a> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 615 | hook does on its standard input.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 616 | <div class="paragraph"><p>This hook does not affect the outcome of <em>git-receive-pack</em>, as it |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 617 | is called after the real work is done.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 618 | <div class="paragraph"><p>This supersedes the <a href="#post-update"><em>post-update</em></a> hook in that it gets |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 619 | both old and new values of all the refs in addition to their |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 620 | names.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 621 | <div class="paragraph"><p>Both standard output and standard error output are forwarded to |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 622 | <em>git send-pack</em> on the other end, so you can simply <tt>echo</tt> messages |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 623 | for the user.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 624 | <div class="paragraph"><p>The default <em>post-receive</em> hook is empty, but there is |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 625 | a sample script <tt>post-receive-email</tt> provided in the <tt>contrib/hooks</tt> |
| 626 | directory in git distribution, which implements sending commit |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 627 | emails.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 628 | <h3 id="post-update">post-update</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 629 | <div class="paragraph"><p>This hook is invoked by <em>git-receive-pack</em> on the remote repository, |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 630 | which happens when a <em>git push</em> is done on a local repository. |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 631 | It executes on the remote repository once after all the refs have |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 632 | been updated.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 633 | <div class="paragraph"><p>It takes a variable number of parameters, each of which is the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 634 | name of ref that was actually updated.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 635 | <div class="paragraph"><p>This hook is meant primarily for notification, and cannot affect |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 636 | the outcome of <em>git-receive-pack</em>.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 637 | <div class="paragraph"><p>The <em>post-update</em> hook can tell what are the heads that were pushed, |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 638 | but it does not know what their original and updated values are, |
| 639 | so it is a poor place to do log old..new. The |
| 640 | <a href="#post-receive"><em>post-receive</em></a> hook does get both original and |
| 641 | updated values of the refs. You might consider it instead if you need |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 642 | them.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 643 | <div class="paragraph"><p>When enabled, the default <em>post-update</em> hook runs |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 644 | <em>git update-server-info</em> to keep the information used by dumb |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 645 | transports (e.g., HTTP) up-to-date. If you are publishing |
| 646 | a git repository that is accessible via HTTP, you should |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 647 | probably enable this hook.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 648 | <div class="paragraph"><p>Both standard output and standard error output are forwarded to |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 649 | <em>git send-pack</em> on the other end, so you can simply <tt>echo</tt> messages |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 650 | for the user.</p></div> |
Junio C Hamano | c28068f | 2009-09-08 00:55:23 | [diff] [blame] | 651 | <h3 id="_pre_auto_gc">pre-auto-gc</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 652 | <div class="paragraph"><p>This hook is invoked by <em>git gc --auto</em>. It takes no parameter, and |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 653 | exiting with non-zero status from this script causes the <em>git gc --auto</em> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 654 | to abort.</p></div> |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 655 | <h3 id="_post_rewrite">post-rewrite</h3><div style="clear:left"></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 656 | <div class="paragraph"><p>This hook is invoked by commands that rewrite commits (<tt>git commit |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 657 | --amend</tt>, <em>git-rebase</em>; currently <em>git-filter-branch</em> does <em>not</em> call |
| 658 | it!). Its first argument denotes the command it was invoked by: |
| 659 | currently one of <tt>amend</tt> or <tt>rebase</tt>. Further command-dependent |
| 660 | arguments may be passed in the future.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 661 | <div class="paragraph"><p>The hook receives a list of the rewritten commits on stdin, in the |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 662 | format</p></div> |
| 663 | <div class="literalblock"> |
| 664 | <div class="content"> |
| 665 | <pre><tt><old-sha1> SP <new-sha1> [ SP <extra-info> ] LF</tt></pre> |
| 666 | </div></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 667 | <div class="paragraph"><p>The <em>extra-info</em> is again command-dependent. If it is empty, the |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 668 | preceding SP is also omitted. Currently, no commands pass any |
| 669 | <em>extra-info</em>.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 670 | <div class="paragraph"><p>The hook always runs after the automatic note copying (see |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 671 | "notes.rewrite.<command>" in linkgit:git-config.txt) has happened, and |
| 672 | thus has access to these notes.</p></div> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 673 | <div class="paragraph"><p>The following command-specific comments apply:</p></div> |
| 674 | <div class="dlist"><dl> |
| 675 | <dt class="hdlist1"> |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 676 | rebase |
| 677 | </dt> |
| 678 | <dd> |
| 679 | <p> |
| 680 | For the <em>squash</em> and <em>fixup</em> operation, all commits that were |
| 681 | squashed are listed as being rewritten to the squashed commit. |
| 682 | This means that there will be several lines sharing the same |
| 683 | <em>new-sha1</em>. |
| 684 | </p> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 685 | <div class="paragraph"><p>The commits are guaranteed to be listed in the order that they were |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 686 | processed by rebase.</p></div> |
| 687 | </dd> |
| 688 | </dl></div> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 689 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 690 | <h2 id="_git">GIT</h2> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 691 | <div class="sectionbody"> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 692 | <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div> |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 693 | </div> |
| 694 | <div id="footer"> |
| 695 | <div id="footer-text"> |
Junio C Hamano | 8143563 | 2011-01-12 09:08:48 | [diff] [blame] | 696 | Last updated 2011-01-12 09:08:33 UTC |
Junio C Hamano | 2fbcd21 | 2008-05-14 22:26:07 | [diff] [blame] | 697 | </div> |
| 698 | </div> |
| 699 | </body> |
| 700 | </html> |