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 | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 8.2.5" /> |
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 | |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 19 | a { |
| 20 | color: blue; |
| 21 | text-decoration: underline; |
| 22 | } |
| 23 | a:visited { |
| 24 | color: fuchsia; |
| 25 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 26 | |
| 27 | em { |
| 28 | font-style: italic; |
| 29 | } |
| 30 | |
| 31 | strong { |
| 32 | font-weight: bold; |
| 33 | } |
| 34 | |
| 35 | tt { |
| 36 | color: navy; |
| 37 | } |
| 38 | |
| 39 | h1, h2, h3, h4, h5, h6 { |
| 40 | color: #527bbd; |
| 41 | font-family: sans-serif; |
| 42 | margin-top: 1.2em; |
| 43 | margin-bottom: 0.5em; |
| 44 | line-height: 1.3; |
| 45 | } |
| 46 | |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 47 | h1, h2, h3 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 48 | border-bottom: 2px solid silver; |
| 49 | } |
| 50 | h2 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 51 | padding-top: 0.5em; |
| 52 | } |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 53 | h3 { |
| 54 | float: left; |
| 55 | } |
| 56 | h3 + * { |
| 57 | clear: left; |
| 58 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 59 | |
| 60 | div.sectionbody { |
| 61 | font-family: serif; |
| 62 | margin-left: 0; |
| 63 | } |
| 64 | |
| 65 | hr { |
| 66 | border: 1px solid silver; |
| 67 | } |
| 68 | |
| 69 | p { |
| 70 | margin-top: 0.5em; |
| 71 | margin-bottom: 0.5em; |
| 72 | } |
| 73 | |
| 74 | pre { |
| 75 | padding: 0; |
| 76 | margin: 0; |
| 77 | } |
| 78 | |
| 79 | span#author { |
| 80 | color: #527bbd; |
| 81 | font-family: sans-serif; |
| 82 | font-weight: bold; |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 83 | font-size: 1.1em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 84 | } |
| 85 | span#email { |
| 86 | } |
| 87 | span#revision { |
| 88 | font-family: sans-serif; |
| 89 | } |
| 90 | |
| 91 | div#footer { |
| 92 | font-family: sans-serif; |
| 93 | font-size: small; |
| 94 | border-top: 2px solid silver; |
| 95 | padding-top: 0.5em; |
| 96 | margin-top: 4.0em; |
| 97 | } |
| 98 | div#footer-text { |
| 99 | float: left; |
| 100 | padding-bottom: 0.5em; |
| 101 | } |
| 102 | div#footer-badges { |
| 103 | float: right; |
| 104 | padding-bottom: 0.5em; |
| 105 | } |
| 106 | |
| 107 | div#preamble, |
| 108 | div.tableblock, div.imageblock, div.exampleblock, div.verseblock, |
| 109 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 110 | div.admonitionblock { |
| 111 | margin-right: 10%; |
| 112 | margin-top: 1.5em; |
| 113 | margin-bottom: 1.5em; |
| 114 | } |
| 115 | div.admonitionblock { |
| 116 | margin-top: 2.5em; |
| 117 | margin-bottom: 2.5em; |
| 118 | } |
| 119 | |
| 120 | div.content { /* Block element content. */ |
| 121 | padding: 0; |
| 122 | } |
| 123 | |
| 124 | /* Block element titles. */ |
| 125 | div.title, caption.title { |
| 126 | font-family: sans-serif; |
| 127 | font-weight: bold; |
| 128 | text-align: left; |
| 129 | margin-top: 1.0em; |
| 130 | margin-bottom: 0.5em; |
| 131 | } |
| 132 | div.title + * { |
| 133 | margin-top: 0; |
| 134 | } |
| 135 | |
| 136 | td div.title:first-child { |
| 137 | margin-top: 0.0em; |
| 138 | } |
| 139 | div.content div.title:first-child { |
| 140 | margin-top: 0.0em; |
| 141 | } |
| 142 | div.content + div.title { |
| 143 | margin-top: 0.0em; |
| 144 | } |
| 145 | |
| 146 | div.sidebarblock > div.content { |
| 147 | background: #ffffee; |
| 148 | border: 1px solid silver; |
| 149 | padding: 0.5em; |
| 150 | } |
| 151 | |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 152 | div.listingblock { |
| 153 | margin-right: 0%; |
| 154 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 155 | div.listingblock > div.content { |
| 156 | border: 1px solid silver; |
| 157 | background: #f4f4f4; |
| 158 | padding: 0.5em; |
| 159 | } |
| 160 | |
| 161 | div.quoteblock > div.content { |
| 162 | padding-left: 2.0em; |
| 163 | } |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 164 | |
| 165 | div.attribution { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 166 | text-align: right; |
| 167 | } |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 168 | div.verseblock + div.attribution { |
| 169 | text-align: left; |
| 170 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 171 | |
| 172 | div.admonitionblock .icon { |
| 173 | vertical-align: top; |
| 174 | font-size: 1.1em; |
| 175 | font-weight: bold; |
| 176 | text-decoration: underline; |
| 177 | color: #527bbd; |
| 178 | padding-right: 0.5em; |
| 179 | } |
| 180 | div.admonitionblock td.content { |
| 181 | padding-left: 0.5em; |
| 182 | border-left: 2px solid silver; |
| 183 | } |
| 184 | |
| 185 | div.exampleblock > div.content { |
| 186 | border-left: 2px solid silver; |
| 187 | padding: 0.5em; |
| 188 | } |
| 189 | |
| 190 | div.verseblock div.content { |
| 191 | white-space: pre; |
| 192 | } |
| 193 | |
| 194 | div.imageblock div.content { padding-left: 0; } |
| 195 | div.imageblock img { border: 1px solid silver; } |
| 196 | span.image img { border-style: none; } |
| 197 | |
| 198 | dl { |
| 199 | margin-top: 0.8em; |
| 200 | margin-bottom: 0.8em; |
| 201 | } |
| 202 | dt { |
| 203 | margin-top: 0.5em; |
| 204 | margin-bottom: 0; |
| 205 | font-style: italic; |
| 206 | } |
| 207 | dd > *:first-child { |
| 208 | margin-top: 0; |
| 209 | } |
| 210 | |
| 211 | ul, ol { |
| 212 | list-style-position: outside; |
| 213 | } |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 214 | div.olist2 ol { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 215 | list-style-type: lower-alpha; |
| 216 | } |
| 217 | |
| 218 | div.tableblock > table { |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 219 | border: 3px solid #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 220 | } |
| 221 | thead { |
| 222 | font-family: sans-serif; |
| 223 | font-weight: bold; |
| 224 | } |
| 225 | tfoot { |
| 226 | font-weight: bold; |
| 227 | } |
| 228 | |
| 229 | div.hlist { |
| 230 | margin-top: 0.8em; |
| 231 | margin-bottom: 0.8em; |
| 232 | } |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 233 | div.hlist td { |
| 234 | padding-bottom: 5px; |
| 235 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 236 | td.hlist1 { |
| 237 | vertical-align: top; |
| 238 | font-style: italic; |
| 239 | padding-right: 0.8em; |
| 240 | } |
| 241 | td.hlist2 { |
| 242 | vertical-align: top; |
| 243 | } |
| 244 | |
| 245 | @media print { |
| 246 | div#footer-badges { display: none; } |
| 247 | } |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 248 | |
| 249 | div#toctitle { |
| 250 | color: #527bbd; |
| 251 | font-family: sans-serif; |
| 252 | font-size: 1.1em; |
| 253 | font-weight: bold; |
| 254 | margin-top: 1.0em; |
| 255 | margin-bottom: 0.1em; |
| 256 | } |
| 257 | |
| 258 | div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { |
| 259 | margin-top: 0; |
| 260 | margin-bottom: 0; |
| 261 | } |
| 262 | div.toclevel2 { |
| 263 | margin-left: 2em; |
| 264 | font-size: 0.9em; |
| 265 | } |
| 266 | div.toclevel3 { |
| 267 | margin-left: 4em; |
| 268 | font-size: 0.9em; |
| 269 | } |
| 270 | div.toclevel4 { |
| 271 | margin-left: 6em; |
| 272 | font-size: 0.9em; |
| 273 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 274 | /* Workarounds for IE6's broken and incomplete CSS2. */ |
| 275 | |
| 276 | div.sidebar-content { |
| 277 | background: #ffffee; |
| 278 | border: 1px solid silver; |
| 279 | padding: 0.5em; |
| 280 | } |
| 281 | div.sidebar-title, div.image-title { |
| 282 | font-family: sans-serif; |
| 283 | font-weight: bold; |
| 284 | margin-top: 0.0em; |
| 285 | margin-bottom: 0.5em; |
| 286 | } |
| 287 | |
| 288 | div.listingblock div.content { |
| 289 | border: 1px solid silver; |
| 290 | background: #f4f4f4; |
| 291 | padding: 0.5em; |
| 292 | } |
| 293 | |
| 294 | div.quoteblock-content { |
| 295 | padding-left: 2.0em; |
| 296 | } |
| 297 | |
| 298 | div.exampleblock-content { |
| 299 | border-left: 2px solid silver; |
| 300 | padding-left: 0.5em; |
| 301 | } |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 302 | |
| 303 | /* IE6 sets dynamically generated links as visited. */ |
| 304 | div#toc a:visited { color: blue; } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 305 | </style> |
| 306 | <title>Everyday GIT With 20 Commands Or So</title> |
| 307 | </head> |
| 308 | <body> |
| 309 | <div id="header"> |
| 310 | <h1>Everyday GIT With 20 Commands Or So</h1> |
| 311 | </div> |
| 312 | <div id="preamble"> |
| 313 | <div class="sectionbody"> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 314 | <div class="para"><p><a href="#Basic Repository">[Basic Repository]</a> commands are needed by people who have a |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 315 | repository --- that is everybody, because every working tree of |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 316 | git is a repository.</p></div> |
| 317 | <div class="para"><p>In addition, <a href="#Individual Developer (Standalone)">[Individual Developer (Standalone)]</a> commands are |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 318 | essential for anybody who makes a commit, even for somebody who |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 319 | works alone.</p></div> |
| 320 | <div class="para"><p>If you work with other people, you will need commands listed in |
| 321 | the <a href="#Individual Developer (Participant)">[Individual Developer (Participant)]</a> section as well.</p></div> |
| 322 | <div class="para"><p>People who play the <a href="#Integrator">[Integrator]</a> role need to learn some more |
| 323 | commands in addition to the above.</p></div> |
| 324 | <div class="para"><p><a href="#Repository Administration">[Repository Administration]</a> commands are for system |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 325 | administrators who are responsible for the care and feeding |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 326 | of git repositories.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 327 | </div> |
| 328 | </div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 329 | <h2 id="_basic_repository_a_id_basic_repository_a">Basic Repository<a id="Basic Repository"></a></h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 330 | <div class="sectionbody"> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 331 | <div class="para"><p>Everybody uses these commands to maintain git repositories.</p></div> |
| 332 | <div class="ilist"><ul> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 333 | <li> |
| 334 | <p> |
Junio C Hamano | fc4d38c | 2007-01-08 06:53:32 | [diff] [blame] | 335 | <a href="git-init.html">git-init(1)</a> or <a href="git-clone.html">git-clone(1)</a> to create a |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 336 | new repository. |
| 337 | </p> |
| 338 | </li> |
| 339 | <li> |
| 340 | <p> |
Junio C Hamano | 7ad22dc | 2007-01-29 02:55:48 | [diff] [blame] | 341 | <a href="git-fsck.html">git-fsck(1)</a> to check the repository for errors. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 342 | </p> |
| 343 | </li> |
| 344 | <li> |
| 345 | <p> |
Junio C Hamano | 5229946 | 2006-12-28 00:59:38 | [diff] [blame] | 346 | <a href="git-gc.html">git-gc(1)</a> to do common housekeeping tasks such as |
| 347 | repack and prune. |
| 348 | </p> |
| 349 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 350 | </ul></div> |
| 351 | <h3 id="_examples">Examples</h3><div style="clear:left"></div> |
| 352 | <div class="vlist"><dl> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 353 | <dt> |
| 354 | Check health and remove cruft. |
| 355 | </dt> |
| 356 | <dd> |
| 357 | <div class="listingblock"> |
| 358 | <div class="content"> |
Junio C Hamano | 7ad22dc | 2007-01-29 02:55:48 | [diff] [blame] | 359 | <pre><tt>$ git fsck <b>(1)</b> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 360 | $ git count-objects <b>(2)</b> |
Junio C Hamano | e27cbd2 | 2007-12-21 17:57:33 | [diff] [blame] | 361 | $ git gc <b>(3)</b></tt></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 362 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 363 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 364 | <li> |
| 365 | <p> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 366 | running without <tt>--full</tt> is usually cheap and assures the |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 367 | repository health reasonably well. |
| 368 | </p> |
| 369 | </li> |
| 370 | <li> |
| 371 | <p> |
| 372 | check how many loose objects there are and how much |
Junio C Hamano | bb8fb05 | 2006-05-30 07:21:12 | [diff] [blame] | 373 | disk space is wasted by not repacking. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 374 | </p> |
| 375 | </li> |
| 376 | <li> |
| 377 | <p> |
Junio C Hamano | a9aee78 | 2008-04-23 16:09:20 | [diff] [blame] | 378 | repacks the local repository and performs other housekeeping tasks. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 379 | </p> |
| 380 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 381 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 382 | </dd> |
| 383 | <dt> |
| 384 | Repack a small project into single pack. |
| 385 | </dt> |
| 386 | <dd> |
| 387 | <div class="listingblock"> |
| 388 | <div class="content"> |
Junio C Hamano | a9aee78 | 2008-04-23 16:09:20 | [diff] [blame] | 389 | <pre><tt>$ git gc <b>(1)</b></tt></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 390 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 391 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 392 | <li> |
| 393 | <p> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 394 | pack all the objects reachable from the refs into one pack, |
| 395 | then remove the other packs. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 396 | </p> |
| 397 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 398 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 399 | </dd> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 400 | </dl></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 401 | </div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 402 | <h2 id="_individual_developer_standalone_a_id_individual_developer_standalone_a">Individual Developer (Standalone)<a id="Individual Developer (Standalone)"></a></h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 403 | <div class="sectionbody"> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 404 | <div class="para"><p>A standalone individual developer does not exchange patches with |
Junio C Hamano | bb8fb05 | 2006-05-30 07:21:12 | [diff] [blame] | 405 | other people, and works alone in a single repository, using the |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 406 | following commands.</p></div> |
| 407 | <div class="ilist"><ul> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 408 | <li> |
| 409 | <p> |
| 410 | <a href="git-show-branch.html">git-show-branch(1)</a> to see where you are. |
| 411 | </p> |
| 412 | </li> |
| 413 | <li> |
| 414 | <p> |
| 415 | <a href="git-log.html">git-log(1)</a> to see what happened. |
| 416 | </p> |
| 417 | </li> |
| 418 | <li> |
| 419 | <p> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 420 | <a href="git-checkout.html">git-checkout(1)</a> and <a href="git-branch.html">git-branch(1)</a> to switch |
| 421 | branches. |
| 422 | </p> |
| 423 | </li> |
| 424 | <li> |
| 425 | <p> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 426 | <a href="git-add.html">git-add(1)</a> to manage the index file. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 427 | </p> |
| 428 | </li> |
| 429 | <li> |
| 430 | <p> |
| 431 | <a href="git-diff.html">git-diff(1)</a> and <a href="git-status.html">git-status(1)</a> to see what |
| 432 | you are in the middle of doing. |
| 433 | </p> |
| 434 | </li> |
| 435 | <li> |
| 436 | <p> |
| 437 | <a href="git-commit.html">git-commit(1)</a> to advance the current branch. |
| 438 | </p> |
| 439 | </li> |
| 440 | <li> |
| 441 | <p> |
| 442 | <a href="git-reset.html">git-reset(1)</a> and <a href="git-checkout.html">git-checkout(1)</a> (with |
| 443 | pathname parameters) to undo changes. |
| 444 | </p> |
| 445 | </li> |
| 446 | <li> |
| 447 | <p> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 448 | <a href="git-merge.html">git-merge(1)</a> to merge between local branches. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 449 | </p> |
| 450 | </li> |
| 451 | <li> |
| 452 | <p> |
| 453 | <a href="git-rebase.html">git-rebase(1)</a> to maintain topic branches. |
| 454 | </p> |
| 455 | </li> |
| 456 | <li> |
| 457 | <p> |
| 458 | <a href="git-tag.html">git-tag(1)</a> to mark known point. |
| 459 | </p> |
| 460 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 461 | </ul></div> |
| 462 | <h3 id="_examples_2">Examples</h3><div style="clear:left"></div> |
| 463 | <div class="vlist"><dl> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 464 | <dt> |
| 465 | Use a tarball as a starting point for a new repository. |
| 466 | </dt> |
| 467 | <dd> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 468 | <div class="listingblock"> |
| 469 | <div class="content"> |
| 470 | <pre><tt>$ tar zxf frotz.tar.gz |
| 471 | $ cd frotz |
Junio C Hamano | fc4d38c | 2007-01-08 06:53:32 | [diff] [blame] | 472 | $ git-init |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 473 | $ git add . <b>(1)</b> |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 474 | $ git commit -m "import of frotz source tree." |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 475 | $ git tag v2.43 <b>(2)</b></tt></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 476 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 477 | <div class="colist"><ol> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 478 | <li> |
| 479 | <p> |
| 480 | add everything under the current directory. |
| 481 | </p> |
| 482 | </li> |
| 483 | <li> |
| 484 | <p> |
| 485 | make a lightweight, unannotated tag. |
| 486 | </p> |
| 487 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 488 | </ol></div> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 489 | </dd> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 490 | <dt> |
| 491 | Create a topic branch and develop. |
| 492 | </dt> |
| 493 | <dd> |
| 494 | <div class="listingblock"> |
| 495 | <div class="content"> |
| 496 | <pre><tt>$ git checkout -b alsa-audio <b>(1)</b> |
| 497 | $ edit/compile/test |
| 498 | $ git checkout -- curses/ux_audio_oss.c <b>(2)</b> |
| 499 | $ git add curses/ux_audio_alsa.c <b>(3)</b> |
| 500 | $ edit/compile/test |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 501 | $ git diff HEAD <b>(4)</b> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 502 | $ git commit -a -s <b>(5)</b> |
| 503 | $ edit/compile/test |
| 504 | $ git reset --soft HEAD^ <b>(6)</b> |
| 505 | $ edit/compile/test |
| 506 | $ git diff ORIG_HEAD <b>(7)</b> |
| 507 | $ git commit -a -c ORIG_HEAD <b>(8)</b> |
| 508 | $ git checkout master <b>(9)</b> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 509 | $ git merge alsa-audio <b>(10)</b> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 510 | $ git log --since='3 days ago' <b>(11)</b> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 511 | $ git log v2.43.. curses/ <b>(12)</b></tt></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 512 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 513 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 514 | <li> |
| 515 | <p> |
| 516 | create a new topic branch. |
| 517 | </p> |
| 518 | </li> |
| 519 | <li> |
| 520 | <p> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 521 | revert your botched changes in <tt>curses/ux_audio_oss.c</tt>. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 522 | </p> |
| 523 | </li> |
| 524 | <li> |
| 525 | <p> |
| 526 | you need to tell git if you added a new file; removal and |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 527 | modification will be caught if you do <tt>git commit -a</tt> later. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 528 | </p> |
| 529 | </li> |
| 530 | <li> |
| 531 | <p> |
| 532 | to see what changes you are committing. |
| 533 | </p> |
| 534 | </li> |
| 535 | <li> |
| 536 | <p> |
| 537 | commit everything as you have tested, with your sign-off. |
| 538 | </p> |
| 539 | </li> |
| 540 | <li> |
| 541 | <p> |
| 542 | take the last commit back, keeping what is in the working tree. |
| 543 | </p> |
| 544 | </li> |
| 545 | <li> |
| 546 | <p> |
| 547 | look at the changes since the premature commit we took back. |
| 548 | </p> |
| 549 | </li> |
| 550 | <li> |
| 551 | <p> |
| 552 | redo the commit undone in the previous step, using the message |
| 553 | you originally wrote. |
| 554 | </p> |
| 555 | </li> |
| 556 | <li> |
| 557 | <p> |
| 558 | switch to the master branch. |
| 559 | </p> |
| 560 | </li> |
| 561 | <li> |
| 562 | <p> |
Junio C Hamano | edd2b0a | 2007-01-15 06:12:45 | [diff] [blame] | 563 | merge a topic branch into your master branch. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 564 | </p> |
| 565 | </li> |
| 566 | <li> |
| 567 | <p> |
| 568 | review commit logs; other forms to limit output can be |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 569 | combined and include <tt>--max-count=10</tt> (show 10 commits), |
| 570 | <tt>--until=2005-12-10</tt>, etc. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 571 | </p> |
| 572 | </li> |
| 573 | <li> |
| 574 | <p> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 575 | view only the changes that touch what's in <tt>curses/</tt> |
| 576 | directory, since <tt>v2.43</tt> tag. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 577 | </p> |
| 578 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 579 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 580 | </dd> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 581 | </dl></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 582 | </div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 583 | <h2 id="_individual_developer_participant_a_id_individual_developer_participant_a">Individual Developer (Participant)<a id="Individual Developer (Participant)"></a></h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 584 | <div class="sectionbody"> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 585 | <div class="para"><p>A developer working as a participant in a group project needs to |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 586 | learn how to communicate with others, and uses these commands in |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 587 | addition to the ones needed by a standalone developer.</p></div> |
| 588 | <div class="ilist"><ul> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 589 | <li> |
| 590 | <p> |
| 591 | <a href="git-clone.html">git-clone(1)</a> from the upstream to prime your local |
| 592 | repository. |
| 593 | </p> |
| 594 | </li> |
| 595 | <li> |
| 596 | <p> |
| 597 | <a href="git-pull.html">git-pull(1)</a> and <a href="git-fetch.html">git-fetch(1)</a> from "origin" |
| 598 | to keep up-to-date with the upstream. |
| 599 | </p> |
| 600 | </li> |
| 601 | <li> |
| 602 | <p> |
| 603 | <a href="git-push.html">git-push(1)</a> to shared repository, if you adopt CVS |
| 604 | style shared repository workflow. |
| 605 | </p> |
| 606 | </li> |
| 607 | <li> |
| 608 | <p> |
| 609 | <a href="git-format-patch.html">git-format-patch(1)</a> to prepare e-mail submission, if |
| 610 | you adopt Linux kernel-style public forum workflow. |
| 611 | </p> |
| 612 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 613 | </ul></div> |
| 614 | <h3 id="_examples_3">Examples</h3><div style="clear:left"></div> |
| 615 | <div class="vlist"><dl> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 616 | <dt> |
| 617 | Clone the upstream and work on it. Feed changes to upstream. |
| 618 | </dt> |
| 619 | <dd> |
| 620 | <div class="listingblock"> |
| 621 | <div class="content"> |
| 622 | <pre><tt>$ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6 |
| 623 | $ cd my2.6 |
| 624 | $ edit/compile/test; git commit -a -s <b>(1)</b> |
| 625 | $ git format-patch origin <b>(2)</b> |
| 626 | $ git pull <b>(3)</b> |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 627 | $ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 <b>(4)</b> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 628 | $ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <b>(5)</b> |
| 629 | $ git reset --hard ORIG_HEAD <b>(6)</b> |
Junio C Hamano | a9aee78 | 2008-04-23 16:09:20 | [diff] [blame] | 630 | $ git gc <b>(7)</b> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 631 | $ git fetch --tags <b>(8)</b></tt></pre> |
| 632 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 633 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 634 | <li> |
| 635 | <p> |
| 636 | repeat as needed. |
| 637 | </p> |
| 638 | </li> |
| 639 | <li> |
| 640 | <p> |
| 641 | extract patches from your branch for e-mail submission. |
| 642 | </p> |
| 643 | </li> |
| 644 | <li> |
| 645 | <p> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 646 | <tt>git pull</tt> fetches from <tt>origin</tt> by default and merges into the |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 647 | current branch. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 648 | </p> |
| 649 | </li> |
| 650 | <li> |
| 651 | <p> |
| 652 | immediately after pulling, look at the changes done upstream |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 653 | since last time we checked, only in the |
| 654 | area we are interested in. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 655 | </p> |
| 656 | </li> |
| 657 | <li> |
| 658 | <p> |
| 659 | fetch from a specific branch from a specific repository and merge. |
| 660 | </p> |
| 661 | </li> |
| 662 | <li> |
| 663 | <p> |
| 664 | revert the pull. |
| 665 | </p> |
| 666 | </li> |
| 667 | <li> |
| 668 | <p> |
| 669 | garbage collect leftover objects from reverted pull. |
| 670 | </p> |
| 671 | </li> |
| 672 | <li> |
| 673 | <p> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 674 | from time to time, obtain official tags from the <tt>origin</tt> |
| 675 | and store them under <tt>.git/refs/tags/</tt>. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 676 | </p> |
| 677 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 678 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 679 | </dd> |
| 680 | <dt> |
| 681 | Push into another repository. |
| 682 | </dt> |
| 683 | <dd> |
| 684 | <div class="listingblock"> |
| 685 | <div class="content"> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 686 | <pre><tt>satellite$ git clone mothership:frotz frotz <b>(1)</b> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 687 | satellite$ cd frotz |
Junio C Hamano | 7ad22dc | 2007-01-29 02:55:48 | [diff] [blame] | 688 | satellite$ git config --get-regexp '^(remote|branch)\.' <b>(2)</b> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 689 | remote.origin.url mothership:frotz |
| 690 | remote.origin.fetch refs/heads/*:refs/remotes/origin/* |
| 691 | branch.master.remote origin |
| 692 | branch.master.merge refs/heads/master |
Junio C Hamano | 7ad22dc | 2007-01-29 02:55:48 | [diff] [blame] | 693 | satellite$ git config remote.origin.push \ |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 694 | master:refs/remotes/satellite/master <b>(3)</b> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 695 | satellite$ edit/compile/test/commit |
| 696 | satellite$ git push origin <b>(4)</b> |
| 697 | |
| 698 | mothership$ cd frotz |
| 699 | mothership$ git checkout master |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 700 | mothership$ git merge satellite/master <b>(5)</b></tt></pre> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 701 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 702 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 703 | <li> |
| 704 | <p> |
| 705 | mothership machine has a frotz repository under your home |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 706 | directory; clone from it to start a repository on the satellite |
| 707 | machine. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 708 | </p> |
| 709 | </li> |
| 710 | <li> |
| 711 | <p> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 712 | clone sets these configuration variables by default. |
| 713 | It arranges <tt>git pull</tt> to fetch and store the branches of mothership |
| 714 | machine to local <tt>remotes/origin/*</tt> tracking branches. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 715 | </p> |
| 716 | </li> |
| 717 | <li> |
| 718 | <p> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 719 | arrange <tt>git push</tt> to push local <tt>master</tt> branch to |
| 720 | <tt>remotes/satellite/master</tt> branch of the mothership machine. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 721 | </p> |
| 722 | </li> |
| 723 | <li> |
| 724 | <p> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 725 | push will stash our work away on <tt>remotes/satellite/master</tt> |
| 726 | tracking branch on the mothership machine. You could use this as |
| 727 | a back-up method. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 728 | </p> |
| 729 | </li> |
| 730 | <li> |
| 731 | <p> |
| 732 | on mothership machine, merge the work done on the satellite |
| 733 | machine into the master branch. |
| 734 | </p> |
| 735 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 736 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 737 | </dd> |
| 738 | <dt> |
| 739 | Branch off of a specific tag. |
| 740 | </dt> |
| 741 | <dd> |
| 742 | <div class="listingblock"> |
| 743 | <div class="content"> |
| 744 | <pre><tt>$ git checkout -b private2.6.14 v2.6.14 <b>(1)</b> |
| 745 | $ edit/compile/test; git commit -a |
| 746 | $ git checkout master |
| 747 | $ git format-patch -k -m --stdout v2.6.14..private2.6.14 | |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 748 | git am -3 -k <b>(2)</b></tt></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 749 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 750 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 751 | <li> |
| 752 | <p> |
| 753 | create a private branch based on a well known (but somewhat behind) |
| 754 | tag. |
| 755 | </p> |
| 756 | </li> |
| 757 | <li> |
| 758 | <p> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 759 | forward port all changes in <tt>private2.6.14</tt> branch to <tt>master</tt> branch |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 760 | without a formal "merging". |
| 761 | </p> |
| 762 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 763 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 764 | </dd> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 765 | </dl></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 766 | </div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 767 | <h2 id="_integrator_a_id_integrator_a">Integrator<a id="Integrator"></a></h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 768 | <div class="sectionbody"> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 769 | <div class="para"><p>A fairly central person acting as the integrator in a group |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 770 | project receives changes made by others, reviews and integrates |
| 771 | them and publishes the result for others to use, using these |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 772 | commands in addition to the ones needed by participants.</p></div> |
| 773 | <div class="ilist"><ul> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 774 | <li> |
| 775 | <p> |
| 776 | <a href="git-am.html">git-am(1)</a> to apply patches e-mailed in from your |
| 777 | contributors. |
| 778 | </p> |
| 779 | </li> |
| 780 | <li> |
| 781 | <p> |
| 782 | <a href="git-pull.html">git-pull(1)</a> to merge from your trusted lieutenants. |
| 783 | </p> |
| 784 | </li> |
| 785 | <li> |
| 786 | <p> |
| 787 | <a href="git-format-patch.html">git-format-patch(1)</a> to prepare and send suggested |
| 788 | alternative to contributors. |
| 789 | </p> |
| 790 | </li> |
| 791 | <li> |
| 792 | <p> |
| 793 | <a href="git-revert.html">git-revert(1)</a> to undo botched commits. |
| 794 | </p> |
| 795 | </li> |
| 796 | <li> |
| 797 | <p> |
| 798 | <a href="git-push.html">git-push(1)</a> to publish the bleeding edge. |
| 799 | </p> |
| 800 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 801 | </ul></div> |
| 802 | <h3 id="_examples_4">Examples</h3><div style="clear:left"></div> |
| 803 | <div class="vlist"><dl> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 804 | <dt> |
| 805 | My typical GIT day. |
| 806 | </dt> |
| 807 | <dd> |
| 808 | <div class="listingblock"> |
| 809 | <div class="content"> |
| 810 | <pre><tt>$ git status <b>(1)</b> |
| 811 | $ git show-branch <b>(2)</b> |
| 812 | $ mailx <b>(3)</b> |
| 813 | & s 2 3 4 5 ./+to-apply |
| 814 | & s 7 8 ./+hold-linus |
| 815 | & q |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 816 | $ git checkout -b topic/one master |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 817 | $ git am -3 -i -s -u ./+to-apply <b>(4)</b> |
| 818 | $ compile/test |
| 819 | $ git checkout -b hold/linus && git am -3 -i -s -u ./+hold-linus <b>(5)</b> |
| 820 | $ git checkout topic/one && git rebase master <b>(6)</b> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 821 | $ git checkout pu && git reset --hard next <b>(7)</b> |
| 822 | $ git merge topic/one topic/two && git merge hold/linus <b>(8)</b> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 823 | $ git checkout maint |
| 824 | $ git cherry-pick master~4 <b>(9)</b> |
| 825 | $ compile/test |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 826 | $ git tag -s -m "GIT 0.99.9x" v0.99.9x <b>(10)</b> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 827 | $ git fetch ko && git show-branch master maint 'tags/ko-*' <b>(11)</b> |
| 828 | $ git push ko <b>(12)</b> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 829 | $ git push ko v0.99.9x <b>(13)</b></tt></pre> |
| 830 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 831 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 832 | <li> |
| 833 | <p> |
| 834 | see what I was in the middle of doing, if any. |
| 835 | </p> |
| 836 | </li> |
| 837 | <li> |
| 838 | <p> |
| 839 | see what topic branches I have and think about how ready |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 840 | they are. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 841 | </p> |
| 842 | </li> |
| 843 | <li> |
| 844 | <p> |
| 845 | read mails, save ones that are applicable, and save others |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 846 | that are not quite ready. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 847 | </p> |
| 848 | </li> |
| 849 | <li> |
| 850 | <p> |
| 851 | apply them, interactively, with my sign-offs. |
| 852 | </p> |
| 853 | </li> |
| 854 | <li> |
| 855 | <p> |
| 856 | create topic branch as needed and apply, again with my |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 857 | sign-offs. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 858 | </p> |
| 859 | </li> |
| 860 | <li> |
| 861 | <p> |
| 862 | rebase internal topic branch that has not been merged to the |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 863 | master, nor exposed as a part of a stable branch. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 864 | </p> |
| 865 | </li> |
| 866 | <li> |
| 867 | <p> |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 868 | restart <tt>pu</tt> every time from the next. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 869 | </p> |
| 870 | </li> |
| 871 | <li> |
| 872 | <p> |
| 873 | and bundle topic branches still cooking. |
| 874 | </p> |
| 875 | </li> |
| 876 | <li> |
| 877 | <p> |
| 878 | backport a critical fix. |
| 879 | </p> |
| 880 | </li> |
| 881 | <li> |
| 882 | <p> |
| 883 | create a signed tag. |
| 884 | </p> |
| 885 | </li> |
| 886 | <li> |
| 887 | <p> |
| 888 | make sure I did not accidentally rewind master beyond what I |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 889 | already pushed out. <tt>ko</tt> shorthand points at the repository I have |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 890 | at kernel.org, and looks like this: |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 891 | </p> |
Junio C Hamano | 7da87bb | 2006-06-06 01:23:49 | [diff] [blame] | 892 | <div class="listingblock"> |
| 893 | <div class="content"> |
| 894 | <pre><tt>$ cat .git/remotes/ko |
| 895 | URL: kernel.org:/pub/scm/git/git.git |
| 896 | Pull: master:refs/tags/ko-master |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 897 | Pull: next:refs/tags/ko-next |
Junio C Hamano | 7da87bb | 2006-06-06 01:23:49 | [diff] [blame] | 898 | Pull: maint:refs/tags/ko-maint |
| 899 | Push: master |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 900 | Push: next |
Junio C Hamano | 7da87bb | 2006-06-06 01:23:49 | [diff] [blame] | 901 | Push: +pu |
| 902 | Push: maint</tt></pre> |
| 903 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 904 | <div class="para"><p>In the output from <tt>git show-branch</tt>, <tt>master</tt> should have |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 905 | everything <tt>ko-master</tt> has, and <tt>next</tt> should have |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 906 | everything <tt>ko-next</tt> has.</p></div> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 907 | </li> |
| 908 | <li> |
| 909 | <p> |
| 910 | push out the bleeding edge. |
| 911 | </p> |
| 912 | </li> |
| 913 | <li> |
| 914 | <p> |
| 915 | push the tag out, too. |
| 916 | </p> |
| 917 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 918 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 919 | </dd> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 920 | </dl></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 921 | </div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 922 | <h2 id="_repository_administration_a_id_repository_administration_a">Repository Administration<a id="Repository Administration"></a></h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 923 | <div class="sectionbody"> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 924 | <div class="para"><p>A repository administrator uses the following tools to set up |
| 925 | and maintain access to the repository by developers.</p></div> |
| 926 | <div class="ilist"><ul> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 927 | <li> |
| 928 | <p> |
| 929 | <a href="git-daemon.html">git-daemon(1)</a> to allow anonymous download from |
| 930 | repository. |
| 931 | </p> |
| 932 | </li> |
| 933 | <li> |
| 934 | <p> |
| 935 | <a href="git-shell.html">git-shell(1)</a> can be used as a <em>restricted login shell</em> |
| 936 | for shared central repository users. |
| 937 | </p> |
| 938 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 939 | </ul></div> |
| 940 | <div class="para"><p><a href="howto/update-hook-example.txt">update hook howto</a> has a good |
| 941 | example of managing a shared central repository.</p></div> |
| 942 | <h3 id="_examples_5">Examples</h3><div style="clear:left"></div> |
| 943 | <div class="vlist"><dl> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 944 | <dt> |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 945 | We assume the following in /etc/services |
| 946 | </dt> |
| 947 | <dd> |
| 948 | <div class="listingblock"> |
| 949 | <div class="content"> |
| 950 | <pre><tt>$ grep 9418 /etc/services |
| 951 | git 9418/tcp # Git Version Control System</tt></pre> |
| 952 | </div></div> |
| 953 | </dd> |
| 954 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 955 | Run git-daemon to serve /pub/scm from inetd. |
| 956 | </dt> |
| 957 | <dd> |
| 958 | <div class="listingblock"> |
| 959 | <div class="content"> |
Junio C Hamano | bb8fb05 | 2006-05-30 07:21:12 | [diff] [blame] | 960 | <pre><tt>$ grep git /etc/inetd.conf |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 961 | git stream tcp nowait nobody \ |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 962 | /usr/bin/git-daemon git-daemon --inetd --export-all /pub/scm</tt></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 963 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 964 | <div class="para"><p>The actual configuration line should be on one line.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 965 | </dd> |
| 966 | <dt> |
Junio C Hamano | 7da87bb | 2006-06-06 01:23:49 | [diff] [blame] | 967 | Run git-daemon to serve /pub/scm from xinetd. |
| 968 | </dt> |
| 969 | <dd> |
| 970 | <div class="listingblock"> |
| 971 | <div class="content"> |
| 972 | <pre><tt>$ cat /etc/xinetd.d/git-daemon |
| 973 | # default: off |
| 974 | # description: The git server offers access to git repositories |
| 975 | service git |
| 976 | { |
| 977 | disable = no |
| 978 | type = UNLISTED |
| 979 | port = 9418 |
| 980 | socket_type = stream |
| 981 | wait = no |
| 982 | user = nobody |
| 983 | server = /usr/bin/git-daemon |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 984 | server_args = --inetd --export-all --base-path=/pub/scm |
Junio C Hamano | 7da87bb | 2006-06-06 01:23:49 | [diff] [blame] | 985 | log_on_failure += USERID |
| 986 | }</tt></pre> |
| 987 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 988 | <div class="para"><p>Check your xinetd(8) documentation and setup, this is from a Fedora system. |
| 989 | Others might be different.</p></div> |
Junio C Hamano | 7da87bb | 2006-06-06 01:23:49 | [diff] [blame] | 990 | </dd> |
| 991 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 992 | Give push/pull only access to developers. |
| 993 | </dt> |
| 994 | <dd> |
| 995 | <div class="listingblock"> |
| 996 | <div class="content"> |
| 997 | <pre><tt>$ grep git /etc/passwd <b>(1)</b> |
| 998 | alice:x:1000:1000::/home/alice:/usr/bin/git-shell |
| 999 | bob:x:1001:1001::/home/bob:/usr/bin/git-shell |
| 1000 | cindy:x:1002:1002::/home/cindy:/usr/bin/git-shell |
| 1001 | david:x:1003:1003::/home/david:/usr/bin/git-shell |
| 1002 | $ grep git /etc/shells <b>(2)</b> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1003 | /usr/bin/git-shell</tt></pre> |
| 1004 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 1005 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1006 | <li> |
| 1007 | <p> |
| 1008 | log-in shell is set to /usr/bin/git-shell, which does not |
Junio C Hamano | 7464064 | 2006-12-27 10:59:55 | [diff] [blame] | 1009 | allow anything but <tt>git push</tt> and <tt>git pull</tt>. The users should |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1010 | get an ssh access to the machine. |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1011 | </p> |
| 1012 | </li> |
| 1013 | <li> |
| 1014 | <p> |
| 1015 | in many distributions /etc/shells needs to list what is used |
| 1016 | as the login shell. |
| 1017 | </p> |
| 1018 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 1019 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1020 | </dd> |
| 1021 | <dt> |
| 1022 | CVS-style shared repository. |
| 1023 | </dt> |
| 1024 | <dd> |
| 1025 | <div class="listingblock"> |
| 1026 | <div class="content"> |
| 1027 | <pre><tt>$ grep git /etc/group <b>(1)</b> |
| 1028 | git:x:9418:alice,bob,cindy,david |
| 1029 | $ cd /home/devo.git |
| 1030 | $ ls -l <b>(2)</b> |
| 1031 | lrwxrwxrwx 1 david git 17 Dec 4 22:40 HEAD -> refs/heads/master |
| 1032 | drwxrwsr-x 2 david git 4096 Dec 4 22:40 branches |
| 1033 | -rw-rw-r-- 1 david git 84 Dec 4 22:40 config |
| 1034 | -rw-rw-r-- 1 david git 58 Dec 4 22:40 description |
| 1035 | drwxrwsr-x 2 david git 4096 Dec 4 22:40 hooks |
| 1036 | -rw-rw-r-- 1 david git 37504 Dec 4 22:40 index |
| 1037 | drwxrwsr-x 2 david git 4096 Dec 4 22:40 info |
| 1038 | drwxrwsr-x 4 david git 4096 Dec 4 22:40 objects |
| 1039 | drwxrwsr-x 4 david git 4096 Nov 7 14:58 refs |
| 1040 | drwxrwsr-x 2 david git 4096 Dec 4 22:40 remotes |
| 1041 | $ ls -l hooks/update <b>(3)</b> |
| 1042 | -r-xr-xr-x 1 david git 3536 Dec 4 22:40 update |
| 1043 | $ cat info/allowed-users <b>(4)</b> |
| 1044 | refs/heads/master alice\|cindy |
| 1045 | refs/heads/doc-update bob |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1046 | refs/tags/v[0-9]* david</tt></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1047 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 1048 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1049 | <li> |
| 1050 | <p> |
| 1051 | place the developers into the same git group. |
| 1052 | </p> |
| 1053 | </li> |
| 1054 | <li> |
| 1055 | <p> |
| 1056 | and make the shared repository writable by the group. |
| 1057 | </p> |
| 1058 | </li> |
| 1059 | <li> |
| 1060 | <p> |
| 1061 | use update-hook example by Carl from Documentation/howto/ |
| 1062 | for branch policy control. |
| 1063 | </p> |
| 1064 | </li> |
| 1065 | <li> |
| 1066 | <p> |
| 1067 | alice and cindy can push into master, only bob can push into doc-update. |
| 1068 | david is the release manager and is the only person who can |
| 1069 | create and push version tags. |
| 1070 | </p> |
| 1071 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 1072 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1073 | </dd> |
| 1074 | <dt> |
| 1075 | HTTP server to support dumb protocol transfer. |
| 1076 | </dt> |
| 1077 | <dd> |
| 1078 | <div class="listingblock"> |
| 1079 | <div class="content"> |
| 1080 | <pre><tt>dev$ git update-server-info <b>(1)</b> |
| 1081 | dev$ ftp user@isp.example.com <b>(2)</b> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1082 | ftp> cp -r .git /home/user/myproject.git</tt></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1083 | </div></div> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 1084 | <div class="colist"><ol> |
Junio C Hamano | c8d88c2 | 2006-04-29 07:02:01 | [diff] [blame] | 1085 | <li> |
| 1086 | <p> |
| 1087 | make sure your info/refs and objects/info/packs are up-to-date |
| 1088 | </p> |
| 1089 | </li> |
| 1090 | <li> |
| 1091 | <p> |
| 1092 | upload to public HTTP server hosted by your ISP. |
| 1093 | </p> |
| 1094 | </li> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 1095 | </ol></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1096 | </dd> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 1097 | </dl></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1098 | </div> |
| 1099 | <div id="footer"> |
| 1100 | <div id="footer-text"> |
Junio C Hamano | 4604fe5 | 2008-09-19 06:37:10 | [diff] [blame] | 1101 | Last updated 2008-09-19 06:33:25 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1102 | </div> |
| 1103 | </div> |
| 1104 | </body> |
| 1105 | </html> |