Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [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 | 6697ac5 | 2006-02-14 08:00:23 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 7.0.2" /> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | <style type="text/css"> |
| 8 | /* Debug borders */ |
| 9 | p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { |
| 10 | /* |
| 11 | border: 1px solid red; |
| 12 | */ |
| 13 | } |
| 14 | |
| 15 | body { |
| 16 | margin: 1em 5% 1em 5%; |
| 17 | } |
| 18 | |
| 19 | a { color: blue; } |
| 20 | a:visited { color: fuchsia; } |
| 21 | |
| 22 | em { |
| 23 | font-style: italic; |
| 24 | } |
| 25 | |
| 26 | strong { |
| 27 | font-weight: bold; |
| 28 | } |
| 29 | |
| 30 | tt { |
| 31 | color: navy; |
| 32 | } |
| 33 | |
| 34 | h1, h2, h3, h4, h5, h6 { |
| 35 | color: #527bbd; |
| 36 | font-family: sans-serif; |
| 37 | margin-top: 1.2em; |
| 38 | margin-bottom: 0.5em; |
| 39 | line-height: 1.3; |
| 40 | } |
| 41 | |
| 42 | h1 { |
| 43 | border-bottom: 2px solid silver; |
| 44 | } |
| 45 | h2 { |
| 46 | border-bottom: 2px solid silver; |
| 47 | padding-top: 0.5em; |
| 48 | } |
| 49 | |
| 50 | div.sectionbody { |
| 51 | font-family: serif; |
| 52 | margin-left: 0; |
| 53 | } |
| 54 | |
| 55 | hr { |
| 56 | border: 1px solid silver; |
| 57 | } |
| 58 | |
| 59 | p { |
| 60 | margin-top: 0.5em; |
| 61 | margin-bottom: 0.5em; |
| 62 | } |
| 63 | |
| 64 | pre { |
| 65 | padding: 0; |
| 66 | margin: 0; |
| 67 | } |
| 68 | |
| 69 | span#author { |
| 70 | color: #527bbd; |
| 71 | font-family: sans-serif; |
| 72 | font-weight: bold; |
| 73 | font-size: 1.2em; |
| 74 | } |
| 75 | span#email { |
| 76 | } |
| 77 | span#revision { |
| 78 | font-family: sans-serif; |
| 79 | } |
| 80 | |
| 81 | div#footer { |
| 82 | font-family: sans-serif; |
| 83 | font-size: small; |
| 84 | border-top: 2px solid silver; |
| 85 | padding-top: 0.5em; |
| 86 | margin-top: 4.0em; |
| 87 | } |
| 88 | div#footer-text { |
| 89 | float: left; |
| 90 | padding-bottom: 0.5em; |
| 91 | } |
| 92 | div#footer-badges { |
| 93 | float: right; |
| 94 | padding-bottom: 0.5em; |
| 95 | } |
| 96 | |
| 97 | div#preamble, |
| 98 | div.tableblock, div.imageblock, div.exampleblock, div.verseblock, |
| 99 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 100 | div.admonitionblock { |
| 101 | margin-right: 10%; |
| 102 | margin-top: 1.5em; |
| 103 | margin-bottom: 1.5em; |
| 104 | } |
| 105 | div.admonitionblock { |
| 106 | margin-top: 2.5em; |
| 107 | margin-bottom: 2.5em; |
| 108 | } |
| 109 | |
| 110 | div.content { /* Block element content. */ |
| 111 | padding: 0; |
| 112 | } |
| 113 | |
| 114 | /* Block element titles. */ |
| 115 | div.title, caption.title { |
| 116 | font-family: sans-serif; |
| 117 | font-weight: bold; |
| 118 | text-align: left; |
| 119 | margin-top: 1.0em; |
| 120 | margin-bottom: 0.5em; |
| 121 | } |
| 122 | div.title + * { |
| 123 | margin-top: 0; |
| 124 | } |
| 125 | |
| 126 | td div.title:first-child { |
| 127 | margin-top: 0.0em; |
| 128 | } |
| 129 | div.content div.title:first-child { |
| 130 | margin-top: 0.0em; |
| 131 | } |
| 132 | div.content + div.title { |
| 133 | margin-top: 0.0em; |
| 134 | } |
| 135 | |
| 136 | div.sidebarblock > div.content { |
| 137 | background: #ffffee; |
| 138 | border: 1px solid silver; |
| 139 | padding: 0.5em; |
| 140 | } |
| 141 | |
| 142 | div.listingblock > div.content { |
| 143 | border: 1px solid silver; |
| 144 | background: #f4f4f4; |
| 145 | padding: 0.5em; |
| 146 | } |
| 147 | |
| 148 | div.quoteblock > div.content { |
| 149 | padding-left: 2.0em; |
| 150 | } |
| 151 | div.quoteblock .attribution { |
| 152 | text-align: right; |
| 153 | } |
| 154 | |
| 155 | div.admonitionblock .icon { |
| 156 | vertical-align: top; |
| 157 | font-size: 1.1em; |
| 158 | font-weight: bold; |
| 159 | text-decoration: underline; |
| 160 | color: #527bbd; |
| 161 | padding-right: 0.5em; |
| 162 | } |
| 163 | div.admonitionblock td.content { |
| 164 | padding-left: 0.5em; |
| 165 | border-left: 2px solid silver; |
| 166 | } |
| 167 | |
| 168 | div.exampleblock > div.content { |
| 169 | border-left: 2px solid silver; |
| 170 | padding: 0.5em; |
| 171 | } |
| 172 | |
| 173 | div.verseblock div.content { |
| 174 | white-space: pre; |
| 175 | } |
| 176 | |
| 177 | div.imageblock div.content { padding-left: 0; } |
| 178 | div.imageblock img { border: 1px solid silver; } |
| 179 | span.image img { border-style: none; } |
| 180 | |
| 181 | dl { |
| 182 | margin-top: 0.8em; |
| 183 | margin-bottom: 0.8em; |
| 184 | } |
| 185 | dt { |
| 186 | margin-top: 0.5em; |
| 187 | margin-bottom: 0; |
| 188 | font-style: italic; |
| 189 | } |
| 190 | dd > *:first-child { |
| 191 | margin-top: 0; |
| 192 | } |
| 193 | |
| 194 | ul, ol { |
| 195 | list-style-position: outside; |
| 196 | } |
| 197 | ol.olist2 { |
| 198 | list-style-type: lower-alpha; |
| 199 | } |
| 200 | |
| 201 | div.tableblock > table { |
| 202 | border-color: #527bbd; |
| 203 | border-width: 3px; |
| 204 | } |
| 205 | thead { |
| 206 | font-family: sans-serif; |
| 207 | font-weight: bold; |
| 208 | } |
| 209 | tfoot { |
| 210 | font-weight: bold; |
| 211 | } |
| 212 | |
| 213 | div.hlist { |
| 214 | margin-top: 0.8em; |
| 215 | margin-bottom: 0.8em; |
| 216 | } |
| 217 | td.hlist1 { |
| 218 | vertical-align: top; |
| 219 | font-style: italic; |
| 220 | padding-right: 0.8em; |
| 221 | } |
| 222 | td.hlist2 { |
| 223 | vertical-align: top; |
| 224 | } |
| 225 | |
| 226 | @media print { |
| 227 | div#footer-badges { display: none; } |
| 228 | } |
| 229 | include::./stylesheets/xhtml11-manpage.css[] |
| 230 | /* Workarounds for IE6's broken and incomplete CSS2. */ |
| 231 | |
| 232 | div.sidebar-content { |
| 233 | background: #ffffee; |
| 234 | border: 1px solid silver; |
| 235 | padding: 0.5em; |
| 236 | } |
| 237 | div.sidebar-title, div.image-title { |
| 238 | font-family: sans-serif; |
| 239 | font-weight: bold; |
| 240 | margin-top: 0.0em; |
| 241 | margin-bottom: 0.5em; |
| 242 | } |
| 243 | |
| 244 | div.listingblock div.content { |
| 245 | border: 1px solid silver; |
| 246 | background: #f4f4f4; |
| 247 | padding: 0.5em; |
| 248 | } |
| 249 | |
| 250 | div.quoteblock-content { |
| 251 | padding-left: 2.0em; |
| 252 | } |
| 253 | |
| 254 | div.exampleblock-content { |
| 255 | border-left: 2px solid silver; |
| 256 | padding-left: 0.5em; |
| 257 | } |
| 258 | </style> |
| 259 | <title>git-ls-files(1)</title> |
| 260 | </head> |
| 261 | <body> |
| 262 | <div id="header"> |
| 263 | <h1> |
| 264 | git-ls-files(1) Manual Page |
| 265 | </h1> |
| 266 | <h2>NAME</h2> |
| 267 | <div class="sectionbody"> |
| 268 | <p>git-ls-files - |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 269 | Show information about files in the index and the working tree |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 270 | </p> |
| 271 | </div> |
| 272 | </div> |
| 273 | <h2>SYNOPSIS</h2> |
| 274 | <div class="sectionbody"> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 275 | <div class="verseblock"> |
| 276 | <div class="content"><em>git-ls-files</em> [-z] [-t] [-v] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 277 | (--[cached|deleted|others|ignored|stage|unmerged|killed|modified])* |
| 278 | (-[c|d|o|i|s|u|k|m])* |
| 279 | [-x <pattern>|--exclude=<pattern>] |
| 280 | [-X <file>|--exclude-from=<file>] |
| 281 | [--exclude-per-directory=<file>] |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 282 | [--error-unmatch] |
Junio C Hamano | 5c3957e | 2006-03-28 00:28:01 | [diff] [blame] | 283 | [--full-name] [--abbrev] [--] [<file>]*</div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 284 | </div> |
| 285 | <h2>DESCRIPTION</h2> |
| 286 | <div class="sectionbody"> |
| 287 | <p>This merges the file listing in the directory cache index with the |
| 288 | actual working directory list, and shows different combinations of the |
| 289 | two.</p> |
| 290 | <p>One or more of the options below may be used to determine the files |
| 291 | shown:</p> |
| 292 | </div> |
| 293 | <h2>OPTIONS</h2> |
| 294 | <div class="sectionbody"> |
| 295 | <dl> |
| 296 | <dt> |
| 297 | -c|--cached |
| 298 | </dt> |
| 299 | <dd> |
| 300 | <p> |
| 301 | Show cached files in the output (default) |
| 302 | </p> |
| 303 | </dd> |
| 304 | <dt> |
| 305 | -d|--deleted |
| 306 | </dt> |
| 307 | <dd> |
| 308 | <p> |
| 309 | Show deleted files in the output |
| 310 | </p> |
| 311 | </dd> |
| 312 | <dt> |
| 313 | -m|--modified |
| 314 | </dt> |
| 315 | <dd> |
| 316 | <p> |
| 317 | Show modified files in the output |
| 318 | </p> |
| 319 | </dd> |
| 320 | <dt> |
| 321 | -o|--others |
| 322 | </dt> |
| 323 | <dd> |
| 324 | <p> |
| 325 | Show other files in the output |
| 326 | </p> |
| 327 | </dd> |
| 328 | <dt> |
| 329 | -i|--ignored |
| 330 | </dt> |
| 331 | <dd> |
| 332 | <p> |
| 333 | Show ignored files in the output |
| 334 | Note the this also reverses any exclude list present. |
| 335 | </p> |
| 336 | </dd> |
| 337 | <dt> |
| 338 | -s|--stage |
| 339 | </dt> |
| 340 | <dd> |
| 341 | <p> |
| 342 | Show stage files in the output |
| 343 | </p> |
| 344 | </dd> |
| 345 | <dt> |
Junio C Hamano | a6331a8 | 2006-01-22 07:50:33 | [diff] [blame] | 346 | --directory |
| 347 | </dt> |
| 348 | <dd> |
| 349 | <p> |
| 350 | If a whole directory is classified as "other", show just its |
| 351 | name (with a trailing slash) and not its whole contents. |
| 352 | </p> |
| 353 | </dd> |
| 354 | <dt> |
Junio C Hamano | f02e09f | 2006-03-27 07:51:03 | [diff] [blame] | 355 | --no-empty-directory |
| 356 | </dt> |
| 357 | <dd> |
| 358 | <p> |
| 359 | Do not list empty directories. Has no effect without --directory. |
| 360 | </p> |
| 361 | </dd> |
| 362 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 363 | -u|--unmerged |
| 364 | </dt> |
| 365 | <dd> |
| 366 | <p> |
| 367 | Show unmerged files in the output (forces --stage) |
| 368 | </p> |
| 369 | </dd> |
| 370 | <dt> |
| 371 | -k|--killed |
| 372 | </dt> |
| 373 | <dd> |
| 374 | <p> |
| 375 | Show files on the filesystem that need to be removed due |
| 376 | to file/directory conflicts for checkout-index to |
| 377 | succeed. |
| 378 | </p> |
| 379 | </dd> |
| 380 | <dt> |
| 381 | -z |
| 382 | </dt> |
| 383 | <dd> |
| 384 | <p> |
| 385 | \0 line termination on output. |
| 386 | </p> |
| 387 | </dd> |
| 388 | <dt> |
| 389 | -x|--exclude=<pattern> |
| 390 | </dt> |
| 391 | <dd> |
| 392 | <p> |
| 393 | Skips files matching pattern. |
| 394 | Note that pattern is a shell wildcard pattern. |
| 395 | </p> |
| 396 | </dd> |
| 397 | <dt> |
| 398 | -X|--exclude-from=<file> |
| 399 | </dt> |
| 400 | <dd> |
| 401 | <p> |
| 402 | exclude patterns are read from <file>; 1 per line. |
| 403 | </p> |
| 404 | </dd> |
| 405 | <dt> |
| 406 | --exclude-per-directory=<file> |
| 407 | </dt> |
| 408 | <dd> |
| 409 | <p> |
| 410 | read additional exclude patterns that apply only to the |
| 411 | directory and its subdirectories in <file>. |
| 412 | </p> |
| 413 | </dd> |
| 414 | <dt> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 415 | --error-unmatch |
| 416 | </dt> |
| 417 | <dd> |
| 418 | <p> |
| 419 | If any <file> does not appear in the index, treat this as an |
| 420 | error (return 1). |
| 421 | </p> |
| 422 | </dd> |
| 423 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 424 | -t |
| 425 | </dt> |
| 426 | <dd> |
| 427 | <p> |
| 428 | Identify the file status with the following tags (followed by |
| 429 | a space) at the start of each line: |
| 430 | </p> |
| 431 | <div class="hlist"><table> |
| 432 | <tr> |
| 433 | <td class="hlist1"> |
| 434 | H |
| 435 | </td> |
| 436 | <td class="hlist2"> |
| 437 | cached |
| 438 | </td> |
| 439 | </tr> |
| 440 | <tr> |
| 441 | <td class="hlist1"> |
| 442 | M |
| 443 | </td> |
| 444 | <td class="hlist2"> |
| 445 | unmerged |
| 446 | </td> |
| 447 | </tr> |
| 448 | <tr> |
| 449 | <td class="hlist1"> |
| 450 | R |
| 451 | </td> |
| 452 | <td class="hlist2"> |
| 453 | removed/deleted |
| 454 | </td> |
| 455 | </tr> |
| 456 | <tr> |
| 457 | <td class="hlist1"> |
| 458 | C |
| 459 | </td> |
| 460 | <td class="hlist2"> |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 461 | modified/changed |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 462 | </td> |
| 463 | </tr> |
| 464 | <tr> |
| 465 | <td class="hlist1"> |
| 466 | K |
| 467 | </td> |
| 468 | <td class="hlist2"> |
| 469 | to be killed |
Junio C Hamano | 6697ac5 | 2006-02-14 08:00:23 | [diff] [blame] | 470 | </td> |
| 471 | </tr> |
| 472 | <tr> |
| 473 | <td class="hlist1"> |
| 474 | ? |
| 475 | </td> |
| 476 | <td class="hlist2"> |
| 477 | other |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 478 | </td> |
| 479 | </tr> |
| 480 | </table></div> |
| 481 | </dd> |
| 482 | <dt> |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 483 | -v |
| 484 | </dt> |
| 485 | <dd> |
| 486 | <p> |
| 487 | Similar to <tt>-t</tt>, but use lowercase letters for files |
| 488 | that are marked as <em>always matching index</em>. |
| 489 | </p> |
| 490 | </dd> |
| 491 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 492 | --full-name |
| 493 | </dt> |
| 494 | <dd> |
| 495 | <p> |
| 496 | When run from a subdirectory, the command usually |
| 497 | outputs paths relative to the current directory. This |
| 498 | option forces paths to be output relative to the project |
| 499 | top directory. |
| 500 | </p> |
| 501 | </dd> |
| 502 | <dt> |
Junio C Hamano | 5c3957e | 2006-03-28 00:28:01 | [diff] [blame] | 503 | --abbrev[=<n>] |
| 504 | </dt> |
| 505 | <dd> |
| 506 | <p> |
| 507 | Instead of showing the full 40-byte hexadecimal object |
| 508 | lines, show only handful hexdigits prefix. |
| 509 | Non default number of digits can be specified with --abbrev=<n>. |
| 510 | </p> |
| 511 | </dd> |
| 512 | <dt> |
Junio C Hamano | 1bb569e | 2006-05-05 23:14:25 | [diff] [blame] | 513 | -- |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 514 | </dt> |
| 515 | <dd> |
| 516 | <p> |
| 517 | Do not interpret any more arguments as options. |
| 518 | </p> |
| 519 | </dd> |
| 520 | <dt> |
| 521 | <file> |
| 522 | </dt> |
| 523 | <dd> |
| 524 | <p> |
| 525 | Files to show. If no files are given all files which match the other |
| 526 | specified criteria are shown. |
| 527 | </p> |
| 528 | </dd> |
| 529 | </dl> |
| 530 | </div> |
| 531 | <h2>Output</h2> |
| 532 | <div class="sectionbody"> |
| 533 | <p>show files just outputs the filename unless <em>--stage</em> is specified in |
| 534 | which case it outputs:</p> |
| 535 | <div class="literalblock"> |
| 536 | <div class="content"> |
| 537 | <pre><tt>[<tag> ]<mode> <object> <stage> <file></tt></pre> |
| 538 | </div></div> |
| 539 | <p>"git-ls-files --unmerged" and "git-ls-files --stage" can be used to examine |
| 540 | detailed information on unmerged paths.</p> |
| 541 | <p>For an unmerged path, instead of recording a single mode/SHA1 pair, |
| 542 | the dircache records up to three such pairs; one from tree O in stage |
| 543 | 1, A in stage 2, and B in stage 3. This information can be used by |
| 544 | the user (or the porcelain) to see what should eventually be recorded at the |
| 545 | path. (see git-read-tree for more information on state)</p> |
| 546 | <p>When <tt>-z</tt> option is not used, TAB, LF, and backslash characters |
| 547 | in pathnames are represented as <tt>\t</tt>, <tt>\n</tt>, and <tt>\\</tt>, |
| 548 | respectively.</p> |
| 549 | </div> |
| 550 | <h2>Exclude Patterns</h2> |
| 551 | <div class="sectionbody"> |
| 552 | <p><em>git-ls-files</em> can use a list of "exclude patterns" when |
| 553 | traversing the directory tree and finding files to show when the |
| 554 | flags --others or --ignored are specified.</p> |
| 555 | <p>These exclude patterns come from these places:</p> |
| 556 | <ol> |
| 557 | <li> |
| 558 | <p> |
| 559 | command line flag --exclude=<pattern> specifies a single |
| 560 | pattern. |
| 561 | </p> |
| 562 | </li> |
| 563 | <li> |
| 564 | <p> |
| 565 | command line flag --exclude-from=<file> specifies a list of |
| 566 | patterns stored in a file. |
| 567 | </p> |
| 568 | </li> |
| 569 | <li> |
| 570 | <p> |
| 571 | command line flag --exclude-per-directory=<name> specifies |
| 572 | a name of the file in each directory <em>git-ls-files</em> |
| 573 | examines, and if exists, its contents are used as an |
| 574 | additional list of patterns. |
| 575 | </p> |
| 576 | </li> |
| 577 | </ol> |
| 578 | <p>An exclude pattern file used by (2) and (3) contains one pattern |
| 579 | per line. A line that starts with a <em>#</em> can be used as comment |
| 580 | for readability.</p> |
| 581 | <p>There are three lists of patterns that are in effect at a given |
| 582 | time. They are built and ordered in the following way:</p> |
| 583 | <ul> |
| 584 | <li> |
| 585 | <p> |
| 586 | --exclude=<pattern> from the command line; patterns are |
| 587 | ordered in the same order as they appear on the command line. |
| 588 | </p> |
| 589 | </li> |
| 590 | <li> |
| 591 | <p> |
| 592 | lines read from --exclude-from=<file>; patterns are ordered |
| 593 | in the same order as they appear in the file. |
| 594 | </p> |
| 595 | </li> |
| 596 | <li> |
| 597 | <p> |
| 598 | When --exclude-per-directory=<name> is specified, upon |
| 599 | entering a directory that has such a file, its contents are |
| 600 | appended at the end of the current "list of patterns". They |
| 601 | are popped off when leaving the directory. |
| 602 | </p> |
| 603 | </li> |
| 604 | </ul> |
| 605 | <p>Each pattern in the pattern list specifies "a match pattern" and |
| 606 | optionally the fate; either a file that matches the pattern is |
| 607 | considered excluded or included. A filename is matched against |
| 608 | the patterns in the three lists; the --exclude-from list is |
| 609 | checked first, then the --exclude-per-directory list, and then |
| 610 | finally the --exclude list. The last match determines its fate. |
| 611 | If there is no match in the three lists, the fate is "included".</p> |
| 612 | <p>A pattern specified on the command line with --exclude or read |
| 613 | from the file specified with --exclude-from is relative to the |
| 614 | top of the directory tree. A pattern read from a file specified |
| 615 | by --exclude-per-directory is relative to the directory that the |
| 616 | pattern file appears in.</p> |
| 617 | <p>An exclude pattern is of the following format:</p> |
| 618 | <ul> |
| 619 | <li> |
| 620 | <p> |
| 621 | an optional prefix <em>!</em> which means that the fate this pattern |
| 622 | specifies is "include", not the usual "exclude"; the |
| 623 | remainder of the pattern string is interpreted according to |
| 624 | the following rules. |
| 625 | </p> |
| 626 | </li> |
| 627 | <li> |
| 628 | <p> |
| 629 | if it does not contain a slash <em>/</em>, it is a shell glob |
| 630 | pattern and used to match against the filename without |
Junio C Hamano | 125c327 | 2006-06-08 03:41:35 | [diff] [blame] | 631 | leading directories. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 632 | </p> |
| 633 | </li> |
| 634 | <li> |
| 635 | <p> |
| 636 | otherwise, it is a shell glob pattern, suitable for |
| 637 | consumption by fnmatch(3) with FNM_PATHNAME flag. I.e. a |
| 638 | slash in the pattern must match a slash in the pathname. |
| 639 | "Documentation/*.html" matches "Documentation/git.html" but |
| 640 | not "ppc/ppc.html". As a natural exception, "/*.c" matches |
| 641 | "cat-file.c" but not "mozilla-sha1/sha1.c". |
| 642 | </p> |
| 643 | </li> |
| 644 | </ul> |
| 645 | <p>An example:</p> |
| 646 | <div class="listingblock"> |
| 647 | <div class="content"> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 648 | <pre><tt> $ cat .git/info/exclude |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 649 | # ignore objects and archives, anywhere in the tree. |
| 650 | *.[oa] |
| 651 | $ cat Documentation/.gitignore |
| 652 | # ignore generated html files, |
| 653 | *.html |
| 654 | # except foo.html which is maintained by hand |
| 655 | !foo.html |
| 656 | $ git-ls-files --ignored \ |
| 657 | --exclude='Documentation/*.[0-9]' \ |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 658 | --exclude-from=.git/info/exclude \ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 659 | --exclude-per-directory=.gitignore</tt></pre> |
| 660 | </div></div> |
Junio C Hamano | 125c327 | 2006-06-08 03:41:35 | [diff] [blame] | 661 | <p>Another example:</p> |
| 662 | <div class="listingblock"> |
| 663 | <div class="content"> |
| 664 | <pre><tt> $ cat .gitignore |
| 665 | vmlinux* |
| 666 | $ ls arch/foo/kernel/vm* |
| 667 | arch/foo/kernel/vmlinux.lds.S |
| 668 | $ echo '!/vmlinux*' >arch/foo/kernel/.gitignore</tt></pre> |
| 669 | </div></div> |
| 670 | <p>The second .gitignore keeps <tt>arch/foo/kernel/vmlinux.lds.S</tt> file |
| 671 | from getting ignored.</p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 672 | </div> |
| 673 | <h2>See Also</h2> |
| 674 | <div class="sectionbody"> |
| 675 | <p><a href="git-read-tree.html">git-read-tree(1)</a></p> |
| 676 | </div> |
| 677 | <h2>Author</h2> |
| 678 | <div class="sectionbody"> |
| 679 | <p>Written by Linus Torvalds <torvalds@osdl.org></p> |
| 680 | </div> |
| 681 | <h2>Documentation</h2> |
| 682 | <div class="sectionbody"> |
| 683 | <p>Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.</p> |
| 684 | </div> |
| 685 | <h2>GIT</h2> |
| 686 | <div class="sectionbody"> |
| 687 | <p>Part of the <a href="git.html">git(7)</a> suite</p> |
| 688 | </div> |
| 689 | <div id="footer"> |
| 690 | <div id="footer-text"> |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 691 | Last updated 19-Jan-2007 00:37:22 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 692 | </div> |
| 693 | </div> |
| 694 | </body> |
| 695 | </html> |