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 | ba4b928 | 2008-07-06 05:20:31 | [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 | ba4b928 | 2008-07-06 05:20:31 | [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 | ba4b928 | 2008-07-06 05:20:31 | [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 | ba4b928 | 2008-07-06 05:20:31 | [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 | ba4b928 | 2008-07-06 05:20:31 | [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 | ba4b928 | 2008-07-06 05:20:31 | [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 | ba4b928 | 2008-07-06 05:20:31 | [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 | ba4b928 | 2008-07-06 05:20:31 | [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 | ba4b928 | 2008-07-06 05:20:31 | [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 | ba4b928 | 2008-07-06 05:20:31 | [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 | ba4b928 | 2008-07-06 05:20:31 | [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 | ba4b928 | 2008-07-06 05:20:31 | [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 | } |
| 274 | include1::./stylesheets/xhtml11-manpage.css[] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 275 | /* Workarounds for IE6's broken and incomplete CSS2. */ |
| 276 | |
| 277 | div.sidebar-content { |
| 278 | background: #ffffee; |
| 279 | border: 1px solid silver; |
| 280 | padding: 0.5em; |
| 281 | } |
| 282 | div.sidebar-title, div.image-title { |
| 283 | font-family: sans-serif; |
| 284 | font-weight: bold; |
| 285 | margin-top: 0.0em; |
| 286 | margin-bottom: 0.5em; |
| 287 | } |
| 288 | |
| 289 | div.listingblock div.content { |
| 290 | border: 1px solid silver; |
| 291 | background: #f4f4f4; |
| 292 | padding: 0.5em; |
| 293 | } |
| 294 | |
| 295 | div.quoteblock-content { |
| 296 | padding-left: 2.0em; |
| 297 | } |
| 298 | |
| 299 | div.exampleblock-content { |
| 300 | border-left: 2px solid silver; |
| 301 | padding-left: 0.5em; |
| 302 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 303 | |
| 304 | /* IE6 sets dynamically generated links as visited. */ |
| 305 | div#toc a:visited { color: blue; } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 306 | </style> |
| 307 | <title>git-push(1)</title> |
| 308 | </head> |
| 309 | <body> |
| 310 | <div id="header"> |
| 311 | <h1> |
| 312 | git-push(1) Manual Page |
| 313 | </h1> |
| 314 | <h2>NAME</h2> |
| 315 | <div class="sectionbody"> |
| 316 | <p>git-push - |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 317 | Update remote refs along with associated objects |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 318 | </p> |
| 319 | </div> |
| 320 | </div> |
| 321 | <h2>SYNOPSIS</h2> |
| 322 | <div class="sectionbody"> |
Junio C Hamano | a9b8d24 | 2007-05-19 04:51:55 | [diff] [blame] | 323 | <div class="verseblock"> |
Junio C Hamano | d6fff40 | 2009-09-14 09:40:50 | [diff] [blame] | 324 | <div class="content"><em>git push</em> [--all | --mirror | --tags] [-n | --dry-run] [--receive-pack=<git-receive-pack>] |
Junio C Hamano | a9701f0 | 2010-01-21 00:42:16 | [diff] [blame] | 325 | [--repo=<repository>] [-f | --force] [-v | --verbose] [-u | --set-upstream] |
Junio C Hamano | 7f80ae8 | 2008-07-30 18:31:35 | [diff] [blame] | 326 | [<repository> <refspec>…]</div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 327 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 328 | <h2 id="_description">DESCRIPTION</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 329 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 330 | <div class="para"><p>Updates remote refs using local refs, while sending objects |
| 331 | necessary to complete the given refs.</p></div> |
| 332 | <div class="para"><p>You can make interesting things happen to a repository |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 333 | every time you push into it, by setting up <em>hooks</em> there. See |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 334 | documentation for <a href="git-receive-pack.html">git-receive-pack(1)</a>.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 335 | </div> |
Junio C Hamano | ea82cff | 2009-03-18 01:54:48 | [diff] [blame] | 336 | <h2 id="_options_a_id_options_a">OPTIONS<a id="OPTIONS"></a></h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 337 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 338 | <div class="vlist"><dl> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 339 | <dt> |
| 340 | <repository> |
| 341 | </dt> |
| 342 | <dd> |
| 343 | <p> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 344 | The "remote" repository that is destination of a push |
Junio C Hamano | cc0cb31 | 2009-01-22 03:38:50 | [diff] [blame] | 345 | operation. This parameter can be either a URL |
| 346 | (see the section <a href="#URLS">GIT URLS</a> below) or the name |
| 347 | of a remote (see the section <a href="#REMOTES">REMOTES</a> below). |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 348 | </p> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 349 | </dd> |
| 350 | <dt> |
Junio C Hamano | 7f80ae8 | 2008-07-30 18:31:35 | [diff] [blame] | 351 | <refspec>… |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 352 | </dt> |
| 353 | <dd> |
| 354 | <p> |
Junio C Hamano | 8b6e23b | 2009-02-01 06:36:08 | [diff] [blame] | 355 | The format of a <refspec> parameter is an optional plus |
| 356 | <tt>+</tt>, followed by the source ref <src>, followed |
| 357 | by a colon <tt>:</tt>, followed by the destination ref <dst>. |
| 358 | It is used to specify with what <src> object the <dst> ref |
| 359 | in the remote repository is to be updated. |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 360 | </p> |
Junio C Hamano | 8b6e23b | 2009-02-01 06:36:08 | [diff] [blame] | 361 | <div class="para"><p>The <src> is often the name of the branch you would want to push, but |
| 362 | it can be any arbitrary "SHA-1 expression", such as <tt>master~4</tt> or |
| 363 | <tt>HEAD</tt> (see <a href="git-rev-parse.html">git-rev-parse(1)</a>).</p></div> |
| 364 | <div class="para"><p>The <dst> tells which ref on the remote side is updated with this |
| 365 | push. Arbitrary expressions cannot be used here, an actual ref must |
| 366 | be named. If <tt>:</tt><dst> is omitted, the same ref as <src> will be |
| 367 | updated.</p></div> |
Junio C Hamano | d533bdb | 2009-02-25 09:56:58 | [diff] [blame] | 368 | <div class="para"><p>The object referenced by <src> is used to update the <dst> reference |
| 369 | on the remote side, but by default this is only allowed if the |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame] | 370 | update can fast-forward <dst>. By having the optional leading <tt>+</tt>, |
Junio C Hamano | d533bdb | 2009-02-25 09:56:58 | [diff] [blame] | 371 | you can tell git to update the <dst> ref even when the update is not a |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame] | 372 | fast-forward. This does <strong>not</strong> attempt to merge <src> into <dst>. See |
Junio C Hamano | d533bdb | 2009-02-25 09:56:58 | [diff] [blame] | 373 | EXAMPLES below for details.</p></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 374 | <div class="para"><p><tt>tag <tag></tt> means the same as <tt>refs/tags/<tag>:refs/tags/<tag></tt>.</p></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 375 | <div class="para"><p>Pushing an empty <src> allows you to delete the <dst> ref from |
| 376 | the remote repository.</p></div> |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame] | 377 | <div class="para"><p>The special refspec <tt>:</tt> (or <tt>+:</tt> to allow non-fast-forward updates) |
Junio C Hamano | cc0cb31 | 2009-01-22 03:38:50 | [diff] [blame] | 378 | directs git to push "matching" branches: for every branch that exists on |
| 379 | the local side, the remote side is updated if a branch of the same name |
Junio C Hamano | b713ff1 | 2008-05-24 01:12:30 | [diff] [blame] | 380 | already exists on the remote side. This is the default operation mode |
| 381 | if no explicit refspec is found (that is neither on the command line |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 382 | nor in any Push line of the corresponding remotes file---see below).</p></div> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 383 | </dd> |
| 384 | <dt> |
| 385 | --all |
| 386 | </dt> |
| 387 | <dd> |
| 388 | <p> |
| 389 | Instead of naming each ref to push, specifies that all |
Junio C Hamano | d2d9ae1 | 2007-09-19 02:27:57 | [diff] [blame] | 390 | refs under <tt>$GIT_DIR/refs/heads/</tt> be pushed. |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 391 | </p> |
| 392 | </dd> |
| 393 | <dt> |
Junio C Hamano | 9d2bbb7 | 2007-11-25 04:56:07 | [diff] [blame] | 394 | --mirror |
| 395 | </dt> |
| 396 | <dd> |
| 397 | <p> |
| 398 | Instead of naming each ref to push, specifies that all |
Junio C Hamano | a351d14 | 2008-06-21 09:40:40 | [diff] [blame] | 399 | refs under <tt>$GIT_DIR/refs/</tt> (which includes but is not |
| 400 | limited to <tt>refs/heads/</tt>, <tt>refs/remotes/</tt>, and <tt>refs/tags/</tt>) |
Junio C Hamano | 9d2bbb7 | 2007-11-25 04:56:07 | [diff] [blame] | 401 | be mirrored to the remote repository. Newly created local |
| 402 | refs will be pushed to the remote end, locally updated refs |
| 403 | will be force updated on the remote end, and deleted refs |
Junio C Hamano | 47d68a5 | 2008-05-06 06:35:40 | [diff] [blame] | 404 | will be removed from the remote end. This is the default |
| 405 | if the configuration option <tt>remote.<remote>.mirror</tt> is |
| 406 | set. |
Junio C Hamano | 9d2bbb7 | 2007-11-25 04:56:07 | [diff] [blame] | 407 | </p> |
| 408 | </dd> |
| 409 | <dt> |
Junio C Hamano | d6fff40 | 2009-09-14 09:40:50 | [diff] [blame] | 410 | -n |
| 411 | </dt> |
| 412 | <dt> |
Junio C Hamano | 764a667 | 2007-10-23 01:23:31 | [diff] [blame] | 413 | --dry-run |
| 414 | </dt> |
| 415 | <dd> |
| 416 | <p> |
| 417 | Do everything except actually send the updates. |
| 418 | </p> |
| 419 | </dd> |
| 420 | <dt> |
Junio C Hamano | 48bc1ce | 2009-07-09 16:49:19 | [diff] [blame] | 421 | --porcelain |
| 422 | </dt> |
| 423 | <dd> |
| 424 | <p> |
| 425 | Produce machine-readable output. The output status line for each ref |
| 426 | will be tab-separated and sent to stdout instead of stderr. The full |
| 427 | symbolic names of the refs will be given. |
| 428 | </p> |
| 429 | </dd> |
| 430 | <dt> |
Junio C Hamano | b141a92 | 2010-01-10 19:55:14 | [diff] [blame] | 431 | --delete |
| 432 | </dt> |
| 433 | <dd> |
| 434 | <p> |
| 435 | All listed refs are deleted from the remote repository. This is |
| 436 | the same as prefixing all refs with a colon. |
| 437 | </p> |
| 438 | </dd> |
| 439 | <dt> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 440 | --tags |
| 441 | </dt> |
| 442 | <dd> |
| 443 | <p> |
| 444 | All refs under <tt>$GIT_DIR/refs/tags</tt> are pushed, in |
| 445 | addition to refspecs explicitly listed on the command |
| 446 | line. |
| 447 | </p> |
| 448 | </dd> |
| 449 | <dt> |
Junio C Hamano | 4ad294b | 2007-01-20 02:22:50 | [diff] [blame] | 450 | --receive-pack=<git-receive-pack> |
Junio C Hamano | 1ce39ab | 2007-01-16 22:05:10 | [diff] [blame] | 451 | </dt> |
Junio C Hamano | 1c95827 | 2009-01-12 18:04:21 | [diff] [blame] | 452 | <dt> |
| 453 | --exec=<git-receive-pack> |
| 454 | </dt> |
Junio C Hamano | 1ce39ab | 2007-01-16 22:05:10 | [diff] [blame] | 455 | <dd> |
| 456 | <p> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 457 | Path to the <em>git-receive-pack</em> program on the remote |
Junio C Hamano | 1ce39ab | 2007-01-16 22:05:10 | [diff] [blame] | 458 | end. Sometimes useful when pushing to a remote |
| 459 | repository over ssh, and you do not have the program in |
| 460 | a directory on the default $PATH. |
| 461 | </p> |
| 462 | </dd> |
| 463 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 464 | -f |
| 465 | </dt> |
| 466 | <dt> |
| 467 | --force |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 468 | </dt> |
| 469 | <dd> |
| 470 | <p> |
| 471 | Usually, the command refuses to update a remote ref that is |
Junio C Hamano | 4cd1c0e | 2007-08-06 04:39:14 | [diff] [blame] | 472 | not an ancestor of the local ref used to overwrite it. |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 473 | This flag disables the check. This can cause the |
| 474 | remote repository to lose commits; use it with care. |
| 475 | </p> |
| 476 | </dd> |
Junio C Hamano | 1ce39ab | 2007-01-16 22:05:10 | [diff] [blame] | 477 | <dt> |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 478 | --repo=<repository> |
Junio C Hamano | 1ce39ab | 2007-01-16 22:05:10 | [diff] [blame] | 479 | </dt> |
| 480 | <dd> |
| 481 | <p> |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 482 | This option is only relevant if no <repository> argument is |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 483 | passed in the invocation. In this case, <em>git push</em> derives the |
Junio C Hamano | a476efa | 2008-10-10 15:31:42 | [diff] [blame] | 484 | remote name from the current branch: If it tracks a remote |
| 485 | branch, then that remote repository is pushed to. Otherwise, |
| 486 | the name "origin" is used. For this latter case, this option |
| 487 | can be used to override the name "origin". In other words, |
| 488 | the difference between these two commands |
Junio C Hamano | 1ce39ab | 2007-01-16 22:05:10 | [diff] [blame] | 489 | </p> |
Junio C Hamano | d0d892c | 2010-01-24 20:06:29 | [diff] [blame] | 490 | <div class="listingblock"> |
| 491 | <div class="content"> |
| 492 | <pre><tt>git push public #1 |
| 493 | git push --repo=public #2</tt></pre> |
| 494 | </div></div> |
| 495 | <div class="para"><p>is that #1 always pushes to "public" whereas #2 pushes to "public" |
| 496 | only if the current branch does not track a remote branch. This is |
| 497 | useful if you write an alias or script around <em>git push</em>.</p></div> |
Junio C Hamano | a9701f0 | 2010-01-21 00:42:16 | [diff] [blame] | 498 | </dd> |
| 499 | <dt> |
| 500 | -u |
| 501 | </dt> |
| 502 | <dt> |
| 503 | --set-upstream |
| 504 | </dt> |
| 505 | <dd> |
| 506 | <p> |
| 507 | For every branch that is up to date or successfully pushed, add |
| 508 | upstream (tracking) reference, used by argument-less |
| 509 | <a href="git-pull.html">git-pull(1)</a> and other commands. For more information, |
| 510 | see <em>branch.<name>.merge</em> in <a href="git-config.html">git-config(1)</a>. |
| 511 | </p> |
Junio C Hamano | 1ce39ab | 2007-01-16 22:05:10 | [diff] [blame] | 512 | </dd> |
| 513 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 514 | --thin |
| 515 | </dt> |
| 516 | <dt> |
| 517 | --no-thin |
Junio C Hamano | 1ce39ab | 2007-01-16 22:05:10 | [diff] [blame] | 518 | </dt> |
| 519 | <dd> |
| 520 | <p> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 521 | These options are passed to <em>git send-pack</em>. Thin |
Junio C Hamano | 1ce39ab | 2007-01-16 22:05:10 | [diff] [blame] | 522 | transfer spends extra cycles to minimize the number of |
| 523 | objects to be sent and meant to be used on slower connection. |
| 524 | </p> |
| 525 | </dd> |
| 526 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 527 | -v |
| 528 | </dt> |
| 529 | <dt> |
| 530 | --verbose |
Junio C Hamano | 1ce39ab | 2007-01-16 22:05:10 | [diff] [blame] | 531 | </dt> |
| 532 | <dd> |
| 533 | <p> |
| 534 | Run verbosely. |
| 535 | </p> |
| 536 | </dd> |
Junio C Hamano | 3d23a0a | 2009-10-19 08:04:30 | [diff] [blame] | 537 | <dt> |
| 538 | -q |
| 539 | </dt> |
| 540 | <dt> |
| 541 | --quiet |
| 542 | </dt> |
| 543 | <dd> |
| 544 | <p> |
| 545 | Suppress all output, including the listing of updated refs, |
| 546 | unless an error occurs. |
| 547 | </p> |
| 548 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 549 | </dl></div> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 550 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 551 | <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 552 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 553 | <div class="para"><p>One of the following notations can be used |
| 554 | to name the remote repository:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 555 | <div class="exampleblock"> |
| 556 | <div class="exampleblock-content"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 557 | <div class="ilist"><ul> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 558 | <li> |
| 559 | <p> |
| 560 | rsync://host.xz/path/to/repo.git/ |
| 561 | </p> |
| 562 | </li> |
| 563 | <li> |
| 564 | <p> |
Junio C Hamano | a3bb6eb | 2009-02-05 01:26:33 | [diff] [blame] | 565 | http://host.xz[:port]/path/to/repo.git/ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 566 | </p> |
| 567 | </li> |
| 568 | <li> |
| 569 | <p> |
Junio C Hamano | a3bb6eb | 2009-02-05 01:26:33 | [diff] [blame] | 570 | https://host.xz[:port]/path/to/repo.git/ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 571 | </p> |
| 572 | </li> |
| 573 | <li> |
| 574 | <p> |
Junio C Hamano | a3bb6eb | 2009-02-05 01:26:33 | [diff] [blame] | 575 | git://host.xz[:port]/path/to/repo.git/ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 576 | </p> |
| 577 | </li> |
| 578 | <li> |
| 579 | <p> |
Junio C Hamano | a3bb6eb | 2009-02-05 01:26:33 | [diff] [blame] | 580 | git://host.xz[:port]/~user/path/to/repo.git/ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 581 | </p> |
| 582 | </li> |
| 583 | <li> |
| 584 | <p> |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 585 | ssh://[user@]host.xz[:port]/path/to/repo.git/ |
| 586 | </p> |
| 587 | </li> |
| 588 | <li> |
| 589 | <p> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 590 | ssh://[user@]host.xz/path/to/repo.git/ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 591 | </p> |
| 592 | </li> |
| 593 | <li> |
| 594 | <p> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 595 | ssh://[user@]host.xz/~user/path/to/repo.git/ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 596 | </p> |
| 597 | </li> |
| 598 | <li> |
| 599 | <p> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 600 | ssh://[user@]host.xz/~/path/to/repo.git |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 601 | </p> |
| 602 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 603 | </ul></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 604 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 605 | <div class="para"><p>SSH is the default transport protocol over the network. You can |
Junio C Hamano | b1d6e88 | 2007-08-11 08:30:16 | [diff] [blame] | 606 | optionally specify which user to log-in as, and an alternate, |
| 607 | scp-like syntax is also supported. Both syntaxes support |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 608 | username expansion, as does the native git protocol, but |
| 609 | only the former supports port specification. The following |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 610 | three are identical to the last three above, respectively:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 611 | <div class="exampleblock"> |
| 612 | <div class="exampleblock-content"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 613 | <div class="ilist"><ul> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 614 | <li> |
| 615 | <p> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 616 | [user@]host.xz:/path/to/repo.git/ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 617 | </p> |
| 618 | </li> |
| 619 | <li> |
| 620 | <p> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 621 | [user@]host.xz:~user/path/to/repo.git/ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 622 | </p> |
| 623 | </li> |
| 624 | <li> |
| 625 | <p> |
Junio C Hamano | 7ccb9fd | 2006-07-15 01:38:40 | [diff] [blame] | 626 | [user@]host.xz:path/to/repo.git |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 627 | </p> |
| 628 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 629 | </ul></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 630 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 631 | <div class="para"><p>To sync with a local directory, you can use:</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 632 | <div class="exampleblock"> |
| 633 | <div class="exampleblock-content"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 634 | <div class="ilist"><ul> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 635 | <li> |
| 636 | <p> |
| 637 | /path/to/repo.git/ |
| 638 | </p> |
| 639 | </li> |
Junio C Hamano | b1d6e88 | 2007-08-11 08:30:16 | [diff] [blame] | 640 | <li> |
| 641 | <p> |
| 642 | file:///path/to/repo.git/ |
| 643 | </p> |
| 644 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 645 | </ul></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 646 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 647 | <div class="para"><p>They are mostly equivalent, except when cloning. See |
| 648 | <a href="git-clone.html">git-clone(1)</a> for details.</p></div> |
| 649 | <div class="para"><p>If there are a large number of similarly-named remote repositories and |
Junio C Hamano | 24bc09a | 2008-02-28 00:27:44 | [diff] [blame] | 650 | you want to use a different format for them (such that the URLs you |
| 651 | use will be rewritten into URLs that work), you can create a |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 652 | configuration section of the form:</p></div> |
Junio C Hamano | 24bc09a | 2008-02-28 00:27:44 | [diff] [blame] | 653 | <div class="listingblock"> |
| 654 | <div class="content"> |
| 655 | <pre><tt> [url "<actual url base>"] |
| 656 | insteadOf = <other url base></tt></pre> |
| 657 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 658 | <div class="para"><p>For example, with this:</p></div> |
Junio C Hamano | 24bc09a | 2008-02-28 00:27:44 | [diff] [blame] | 659 | <div class="listingblock"> |
| 660 | <div class="content"> |
| 661 | <pre><tt> [url "git://git.host.xz/"] |
| 662 | insteadOf = host.xz:/path/to/ |
| 663 | insteadOf = work:</tt></pre> |
| 664 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 665 | <div class="para"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be |
| 666 | rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div> |
Junio C Hamano | 7df6dcf | 2009-09-13 09:51:17 | [diff] [blame] | 667 | <div class="para"><p>If you want to rewrite URLs for push only, you can create a |
| 668 | configuration section of the form:</p></div> |
| 669 | <div class="listingblock"> |
| 670 | <div class="content"> |
| 671 | <pre><tt> [url "<actual url base>"] |
| 672 | pushInsteadOf = <other url base></tt></pre> |
| 673 | </div></div> |
| 674 | <div class="para"><p>For example, with this:</p></div> |
| 675 | <div class="listingblock"> |
| 676 | <div class="content"> |
| 677 | <pre><tt> [url "ssh://example.org/"] |
| 678 | pushInsteadOf = git://example.org/</tt></pre> |
| 679 | </div></div> |
| 680 | <div class="para"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to |
| 681 | "ssh://example.org/path/to/repo.git" for pushes, but pulls will still |
| 682 | use the original URL.</p></div> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 683 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 684 | <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 685 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 686 | <div class="para"><p>The name of one of the following can be used instead |
| 687 | of a URL as <tt><repository></tt> argument:</p></div> |
| 688 | <div class="ilist"><ul> |
Junio C Hamano | 054ea08 | 2008-06-01 08:26:34 | [diff] [blame] | 689 | <li> |
| 690 | <p> |
| 691 | a remote in the git configuration file: <tt>$GIT_DIR/config</tt>, |
| 692 | </p> |
| 693 | </li> |
| 694 | <li> |
| 695 | <p> |
| 696 | a file in the <tt>$GIT_DIR/remotes</tt> directory, or |
| 697 | </p> |
| 698 | </li> |
| 699 | <li> |
| 700 | <p> |
| 701 | a file in the <tt>$GIT_DIR/branches</tt> directory. |
| 702 | </p> |
| 703 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 704 | </ul></div> |
| 705 | <div class="para"><p>All of these also allow you to omit the refspec from the command line |
| 706 | because they each contain a refspec which git will use by default.</p></div> |
| 707 | <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3><div style="clear:left"></div> |
| 708 | <div class="para"><p>You can choose to provide the name of a remote which you had previously |
Junio C Hamano | 054ea08 | 2008-06-01 08:26:34 | [diff] [blame] | 709 | configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a> |
| 710 | or even by a manual edit to the <tt>$GIT_DIR/config</tt> file. The URL of |
| 711 | this remote will be used to access the repository. The refspec |
| 712 | of this remote will be used by default when you do |
| 713 | not provide a refspec on the command line. The entry in the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 714 | config file would appear like this:</p></div> |
Junio C Hamano | 054ea08 | 2008-06-01 08:26:34 | [diff] [blame] | 715 | <div class="listingblock"> |
| 716 | <div class="content"> |
| 717 | <pre><tt> [remote "<name>"] |
| 718 | url = <url> |
Junio C Hamano | 0e88f3e | 2009-06-21 08:03:25 | [diff] [blame] | 719 | pushurl = <pushurl> |
Junio C Hamano | 054ea08 | 2008-06-01 08:26:34 | [diff] [blame] | 720 | push = <refspec> |
| 721 | fetch = <refspec></tt></pre> |
| 722 | </div></div> |
Junio C Hamano | 0e88f3e | 2009-06-21 08:03:25 | [diff] [blame] | 723 | <div class="para"><p>The <tt><pushurl></tt> is used for pushes only. It is optional and defaults |
| 724 | to <tt><url></tt>.</p></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 725 | <h3 id="_named_file_in_tt_git_dir_remotes_tt">Named file in <tt>$GIT_DIR/remotes</tt></h3><div style="clear:left"></div> |
| 726 | <div class="para"><p>You can choose to provide the name of a |
Junio C Hamano | 054ea08 | 2008-06-01 08:26:34 | [diff] [blame] | 727 | file in <tt>$GIT_DIR/remotes</tt>. The URL |
| 728 | in this file will be used to access the repository. The refspec |
| 729 | in this file will be used as default when you do not |
| 730 | provide a refspec on the command line. This file should have the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 731 | following format:</p></div> |
Junio C Hamano | 1caaf47 | 2006-12-31 08:29:35 | [diff] [blame] | 732 | <div class="listingblock"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 733 | <div class="content"> |
Junio C Hamano | d3361ad | 2007-01-01 03:20:24 | [diff] [blame] | 734 | <pre><tt> URL: one of the above URL format |
| 735 | Push: <refspec> |
| 736 | Pull: <refspec> |
| 737 | </tt></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 738 | </div></div> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 739 | <div class="para"><p><tt>Push:</tt> lines are used by <em>git push</em> and |
| 740 | <tt>Pull:</tt> lines are used by <em>git pull</em> and <em>git fetch</em>. |
Junio C Hamano | 054ea08 | 2008-06-01 08:26:34 | [diff] [blame] | 741 | Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 742 | be specified for additional branch mappings.</p></div> |
| 743 | <h3 id="_named_file_in_tt_git_dir_branches_tt">Named file in <tt>$GIT_DIR/branches</tt></h3><div style="clear:left"></div> |
| 744 | <div class="para"><p>You can choose to provide the name of a |
Junio C Hamano | 054ea08 | 2008-06-01 08:26:34 | [diff] [blame] | 745 | file in <tt>$GIT_DIR/branches</tt>. |
| 746 | The URL in this file will be used to access the repository. |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 747 | This file should have the following format:</p></div> |
Junio C Hamano | 1caaf47 | 2006-12-31 08:29:35 | [diff] [blame] | 748 | <div class="listingblock"> |
Junio C Hamano | 249572f | 2006-10-24 05:44:08 | [diff] [blame] | 749 | <div class="content"> |
Junio C Hamano | 054ea08 | 2008-06-01 08:26:34 | [diff] [blame] | 750 | <pre><tt> <url>#<head></tt></pre> |
Junio C Hamano | 249572f | 2006-10-24 05:44:08 | [diff] [blame] | 751 | </div></div> |
Junio C Hamano | 2836349 | 2008-11-14 08:26:31 | [diff] [blame] | 752 | <div class="para"><p><tt><url></tt> is required; <tt>#<head></tt> is optional.</p></div> |
| 753 | <div class="para"><p>Depending on the operation, git will use one of the following |
| 754 | refspecs, if you don't provide one on the command line. |
| 755 | <tt><branch></tt> is the name of this file in <tt>$GIT_DIR/branches</tt> and |
| 756 | <tt><head></tt> defaults to <tt>master</tt>.</p></div> |
| 757 | <div class="para"><p>git fetch uses:</p></div> |
Junio C Hamano | 1caaf47 | 2006-12-31 08:29:35 | [diff] [blame] | 758 | <div class="listingblock"> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 759 | <div class="content"> |
Junio C Hamano | 2836349 | 2008-11-14 08:26:31 | [diff] [blame] | 760 | <pre><tt> refs/heads/<head>:refs/heads/<branch></tt></pre> |
| 761 | </div></div> |
| 762 | <div class="para"><p>git push uses:</p></div> |
| 763 | <div class="listingblock"> |
| 764 | <div class="content"> |
| 765 | <pre><tt> HEAD:refs/heads/<head></tt></pre> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 766 | </div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 767 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 768 | <h2 id="_output">OUTPUT</h2> |
Junio C Hamano | 6d559fc | 2008-02-20 10:44:26 | [diff] [blame] | 769 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 770 | <div class="para"><p>The output of "git push" depends on the transport method used; this |
Junio C Hamano | 6d559fc | 2008-02-20 10:44:26 | [diff] [blame] | 771 | section describes the output when pushing over the git protocol (either |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 772 | locally or via ssh).</p></div> |
| 773 | <div class="para"><p>The status of the push is output in tabular form, with each line |
| 774 | representing the status of a single ref. Each line is of the form:</p></div> |
Junio C Hamano | 6d559fc | 2008-02-20 10:44:26 | [diff] [blame] | 775 | <div class="listingblock"> |
| 776 | <div class="content"> |
| 777 | <pre><tt> <flag> <summary> <from> -> <to> (<reason>)</tt></pre> |
| 778 | </div></div> |
Junio C Hamano | 48bc1ce | 2009-07-09 16:49:19 | [diff] [blame] | 779 | <div class="para"><p>If --porcelain is used, then each line of the output is of the form:</p></div> |
| 780 | <div class="listingblock"> |
| 781 | <div class="content"> |
| 782 | <pre><tt> <flag> \t <from>:<to> \t <summary> (<reason>)</tt></pre> |
| 783 | </div></div> |
Junio C Hamano | 78b92a8 | 2010-02-09 07:34:13 | [diff] [blame] | 784 | <div class="para"><p>The status of up-to-date refs is shown only if --porcelain or --verbose |
| 785 | option is used.</p></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 786 | <div class="vlist"><dl> |
Junio C Hamano | 6d559fc | 2008-02-20 10:44:26 | [diff] [blame] | 787 | <dt> |
| 788 | flag |
| 789 | </dt> |
| 790 | <dd> |
| 791 | <p> |
Junio C Hamano | 78b92a8 | 2010-02-09 07:34:13 | [diff] [blame] | 792 | A single character indicating the status of the ref: |
Junio C Hamano | 6d559fc | 2008-02-20 10:44:26 | [diff] [blame] | 793 | </p> |
Junio C Hamano | 78b92a8 | 2010-02-09 07:34:13 | [diff] [blame] | 794 | <div class="hlist"><table> |
| 795 | <tr> |
| 796 | <td class="hlist1"> |
| 797 | (space) |
| 798 | </td> |
| 799 | <td class="hlist2"> |
| 800 | for a successfully pushed fast-forward; |
| 801 | </td> |
| 802 | </tr> |
| 803 | <tr> |
| 804 | <td class="hlist1"> |
| 805 | <tt>+</tt> |
| 806 | </td> |
| 807 | <td class="hlist2"> |
| 808 | for a successful forced update; |
| 809 | </td> |
| 810 | </tr> |
| 811 | <tr> |
| 812 | <td class="hlist1"> |
| 813 | <tt>-</tt> |
| 814 | </td> |
| 815 | <td class="hlist2"> |
| 816 | for a successfully deleted ref; |
| 817 | </td> |
| 818 | </tr> |
| 819 | <tr> |
| 820 | <td class="hlist1"> |
| 821 | <tt>*</tt> |
| 822 | </td> |
| 823 | <td class="hlist2"> |
| 824 | for a successfully pushed new ref; |
| 825 | </td> |
| 826 | </tr> |
| 827 | <tr> |
| 828 | <td class="hlist1"> |
| 829 | <tt>!</tt> |
| 830 | </td> |
| 831 | <td class="hlist2"> |
| 832 | for a ref that was rejected or failed to push; and |
| 833 | </td> |
| 834 | </tr> |
| 835 | <tr> |
| 836 | <td class="hlist1"> |
| 837 | <tt>=</tt> |
| 838 | </td> |
| 839 | <td class="hlist2"> |
| 840 | for a ref that was up to date and did not need pushing. |
| 841 | </td> |
| 842 | </tr> |
| 843 | </table></div> |
Junio C Hamano | 6d559fc | 2008-02-20 10:44:26 | [diff] [blame] | 844 | </dd> |
| 845 | <dt> |
| 846 | summary |
| 847 | </dt> |
| 848 | <dd> |
| 849 | <p> |
| 850 | For a successfully pushed ref, the summary shows the old and new |
| 851 | values of the ref in a form suitable for using as an argument to |
| 852 | <tt>git log</tt> (this is <tt><old>..<new></tt> in most cases, and |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame] | 853 | <tt><old>…<new></tt> for forced non-fast-forward updates). For a |
Junio C Hamano | 6d559fc | 2008-02-20 10:44:26 | [diff] [blame] | 854 | failed update, more details are given for the failure. |
| 855 | The string <tt>rejected</tt> indicates that git did not try to send the |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame] | 856 | ref at all (typically because it is not a fast-forward). The |
Junio C Hamano | 6d559fc | 2008-02-20 10:44:26 | [diff] [blame] | 857 | string <tt>remote rejected</tt> indicates that the remote end refused |
| 858 | the update; this rejection is typically caused by a hook on the |
| 859 | remote side. The string <tt>remote failure</tt> indicates that the |
| 860 | remote end did not report the successful update of the ref |
| 861 | (perhaps because of a temporary error on the remote side, a |
| 862 | break in the network connection, or other transient error). |
| 863 | </p> |
| 864 | </dd> |
| 865 | <dt> |
| 866 | from |
| 867 | </dt> |
| 868 | <dd> |
| 869 | <p> |
| 870 | The name of the local ref being pushed, minus its |
| 871 | <tt>refs/<type>/</tt> prefix. In the case of deletion, the |
| 872 | name of the local ref is omitted. |
| 873 | </p> |
| 874 | </dd> |
| 875 | <dt> |
| 876 | to |
| 877 | </dt> |
| 878 | <dd> |
| 879 | <p> |
| 880 | The name of the remote ref being updated, minus its |
| 881 | <tt>refs/<type>/</tt> prefix. |
| 882 | </p> |
| 883 | </dd> |
| 884 | <dt> |
| 885 | reason |
| 886 | </dt> |
| 887 | <dd> |
| 888 | <p> |
| 889 | A human-readable explanation. In the case of successfully pushed |
| 890 | refs, no explanation is needed. For a failed ref, the reason for |
| 891 | failure is described. |
| 892 | </p> |
| 893 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 894 | </dl></div> |
Junio C Hamano | 6d559fc | 2008-02-20 10:44:26 | [diff] [blame] | 895 | </div> |
Junio C Hamano | 27a128b | 2009-08-13 01:23:00 | [diff] [blame] | 896 | <h2 id="_note_about_fast_forwards">Note about fast-forwards</h2> |
| 897 | <div class="sectionbody"> |
| 898 | <div class="para"><p>When an update changes a branch (or more in general, a ref) that used to |
| 899 | point at commit A to point at another commit B, it is called a |
| 900 | fast-forward update if and only if B is a descendant of A.</p></div> |
| 901 | <div class="para"><p>In a fast-forward update from A to B, the set of commits that the original |
| 902 | commit A built on top of is a subset of the commits the new commit B |
| 903 | builds on top of. Hence, it does not lose any history.</p></div> |
| 904 | <div class="para"><p>In contrast, a non-fast-forward update will lose history. For example, |
| 905 | suppose you and somebody else started at the same commit X, and you built |
| 906 | a history leading to commit B while the other person built a history |
| 907 | leading to commit A. The history looks like this:</p></div> |
| 908 | <div class="listingblock"> |
| 909 | <div class="content"> |
| 910 | <pre><tt> |
| 911 | B |
| 912 | / |
| 913 | ---X---A |
| 914 | </tt></pre> |
| 915 | </div></div> |
| 916 | <div class="para"><p>Further suppose that the other person already pushed changes leading to A |
| 917 | back to the original repository you two obtained the original commit X.</p></div> |
| 918 | <div class="para"><p>The push done by the other person updated the branch that used to point at |
| 919 | commit X to point at commit A. It is a fast-forward.</p></div> |
| 920 | <div class="para"><p>But if you try to push, you will attempt to update the branch (that |
| 921 | now points at A) with commit B. This does _not_ fast-forward. If you did |
| 922 | so, the changes introduced by commit A will be lost, because everybody |
| 923 | will now start building on top of B.</p></div> |
| 924 | <div class="para"><p>The command by default does not allow an update that is not a fast-forward |
| 925 | to prevent such loss of history.</p></div> |
| 926 | <div class="para"><p>If you do not want to lose your work (history from X to B) nor the work by |
| 927 | the other person (history from X to A), you would need to first fetch the |
| 928 | history from the repository, create a history that contains changes done |
| 929 | by both parties, and push the result back.</p></div> |
| 930 | <div class="para"><p>You can perform "git pull", resolve potential conflicts, and "git push" |
| 931 | the result. A "git pull" will create a merge commit C between commits A |
| 932 | and B.</p></div> |
| 933 | <div class="listingblock"> |
| 934 | <div class="content"> |
| 935 | <pre><tt> |
| 936 | B---C |
| 937 | / / |
| 938 | ---X---A |
| 939 | </tt></pre> |
| 940 | </div></div> |
| 941 | <div class="para"><p>Updating A with the resulting merge commit will fast-forward and your |
| 942 | push will be accepted.</p></div> |
| 943 | <div class="para"><p>Alternatively, you can rebase your change between X and B on top of A, |
| 944 | with "git pull --rebase", and push the result back. The rebase will |
| 945 | create a new commit D that builds the change between X and B on top of |
| 946 | A.</p></div> |
| 947 | <div class="listingblock"> |
| 948 | <div class="content"> |
| 949 | <pre><tt> |
| 950 | B D |
| 951 | / / |
| 952 | ---X---A |
| 953 | </tt></pre> |
| 954 | </div></div> |
| 955 | <div class="para"><p>Again, updating A with this commit will fast-forward and your push will be |
| 956 | accepted.</p></div> |
| 957 | <div class="para"><p>There is another common situation where you may encounter non-fast-forward |
| 958 | rejection when you try to push, and it is possible even when you are |
| 959 | pushing into a repository nobody else pushes into. After you push commit |
| 960 | A yourself (in the first picture in this section), replace it with "git |
| 961 | commit --amend" to produce commit B, and you try to push it out, because |
| 962 | forgot that you have pushed A out already. In such a case, and only if |
| 963 | you are certain that nobody in the meantime fetched your earlier commit A |
| 964 | (and started building on top of it), you can run "git push --force" to |
| 965 | overwrite it. In other words, "git push --force" is a method reserved for |
| 966 | a case where you do mean to lose history.</p></div> |
| 967 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 968 | <h2 id="_examples">Examples</h2> |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 969 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 970 | <div class="vlist"><dl> |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 971 | <dt> |
Junio C Hamano | ea82cff | 2009-03-18 01:54:48 | [diff] [blame] | 972 | git push |
| 973 | </dt> |
| 974 | <dd> |
| 975 | <p> |
| 976 | Works like <tt>git push <remote></tt>, where <remote> is the |
| 977 | current branch's remote (or <tt>origin</tt>, if no remote is |
| 978 | configured for the current branch). |
| 979 | </p> |
| 980 | </dd> |
| 981 | <dt> |
| 982 | git push origin |
| 983 | </dt> |
| 984 | <dd> |
| 985 | <p> |
| 986 | Without additional configuration, works like |
| 987 | <tt>git push origin :</tt>. |
| 988 | </p> |
| 989 | <div class="para"><p>The default behavior of this command when no <refspec> is given can be |
| 990 | configured by setting the <tt>push</tt> option of the remote.</p></div> |
| 991 | <div class="para"><p>For example, to default to pushing only the current branch to <tt>origin</tt> |
| 992 | use <tt>git config remote.origin.push HEAD</tt>. Any valid <refspec> (like |
| 993 | the ones in the examples below) can be configured as the default for |
| 994 | <tt>git push origin</tt>.</p></div> |
| 995 | </dd> |
| 996 | <dt> |
| 997 | git push origin : |
| 998 | </dt> |
| 999 | <dd> |
| 1000 | <p> |
| 1001 | Push "matching" branches to <tt>origin</tt>. See |
| 1002 | <refspec> in the <a href="#OPTIONS">OPTIONS</a> section above for a |
| 1003 | description of "matching" branches. |
| 1004 | </p> |
| 1005 | </dd> |
| 1006 | <dt> |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 1007 | git push origin master |
| 1008 | </dt> |
| 1009 | <dd> |
| 1010 | <p> |
| 1011 | Find a ref that matches <tt>master</tt> in the source repository |
| 1012 | (most likely, it would find <tt>refs/heads/master</tt>), and update |
| 1013 | the same ref (e.g. <tt>refs/heads/master</tt>) in <tt>origin</tt> repository |
Junio C Hamano | a9aee78 | 2008-04-23 16:09:20 | [diff] [blame] | 1014 | with it. If <tt>master</tt> did not exist remotely, it would be |
| 1015 | created. |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 1016 | </p> |
| 1017 | </dd> |
| 1018 | <dt> |
Junio C Hamano | 8b6e23b | 2009-02-01 06:36:08 | [diff] [blame] | 1019 | git push origin HEAD |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 1020 | </dt> |
| 1021 | <dd> |
| 1022 | <p> |
Junio C Hamano | 8b6e23b | 2009-02-01 06:36:08 | [diff] [blame] | 1023 | A handy way to push the current branch to the same name on the |
| 1024 | remote. |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 1025 | </p> |
| 1026 | </dd> |
| 1027 | <dt> |
Junio C Hamano | 7f80ae8 | 2008-07-30 18:31:35 | [diff] [blame] | 1028 | git push origin master:satellite/master dev:satellite/dev |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 1029 | </dt> |
| 1030 | <dd> |
| 1031 | <p> |
Junio C Hamano | 7f80ae8 | 2008-07-30 18:31:35 | [diff] [blame] | 1032 | Use the source ref that matches <tt>master</tt> (e.g. <tt>refs/heads/master</tt>) |
| 1033 | to update the ref that matches <tt>satellite/master</tt> (most probably |
| 1034 | <tt>refs/remotes/satellite/master</tt>) in the <tt>origin</tt> repository, then |
| 1035 | do the same for <tt>dev</tt> and <tt>satellite/dev</tt>. |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 1036 | </p> |
| 1037 | </dd> |
Junio C Hamano | bfd4f9a | 2007-09-06 08:52:44 | [diff] [blame] | 1038 | <dt> |
Junio C Hamano | 8b6e23b | 2009-02-01 06:36:08 | [diff] [blame] | 1039 | git push origin HEAD:master |
| 1040 | </dt> |
| 1041 | <dd> |
| 1042 | <p> |
| 1043 | Push the current branch to the remote ref matching <tt>master</tt> in the |
| 1044 | <tt>origin</tt> repository. This form is convenient to push the current |
| 1045 | branch without thinking about its local name. |
| 1046 | </p> |
| 1047 | </dd> |
| 1048 | <dt> |
Junio C Hamano | bfd4f9a | 2007-09-06 08:52:44 | [diff] [blame] | 1049 | git push origin master:refs/heads/experimental |
| 1050 | </dt> |
| 1051 | <dd> |
| 1052 | <p> |
| 1053 | Create the branch <tt>experimental</tt> in the <tt>origin</tt> repository |
Junio C Hamano | a9aee78 | 2008-04-23 16:09:20 | [diff] [blame] | 1054 | by copying the current <tt>master</tt> branch. This form is only |
| 1055 | needed to create a new branch or tag in the remote repository when |
| 1056 | the local name and the remote name are different; otherwise, |
| 1057 | the ref name on its own will work. |
Junio C Hamano | bfd4f9a | 2007-09-06 08:52:44 | [diff] [blame] | 1058 | </p> |
| 1059 | </dd> |
Junio C Hamano | 8b6e23b | 2009-02-01 06:36:08 | [diff] [blame] | 1060 | <dt> |
| 1061 | git push origin :experimental |
| 1062 | </dt> |
| 1063 | <dd> |
| 1064 | <p> |
| 1065 | Find a ref that matches <tt>experimental</tt> in the <tt>origin</tt> repository |
| 1066 | (e.g. <tt>refs/heads/experimental</tt>), and delete it. |
| 1067 | </p> |
| 1068 | </dd> |
Junio C Hamano | d533bdb | 2009-02-25 09:56:58 | [diff] [blame] | 1069 | <dt> |
| 1070 | git push origin +dev:master |
| 1071 | </dt> |
| 1072 | <dd> |
| 1073 | <p> |
| 1074 | Update the origin repository's master branch with the dev branch, |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame] | 1075 | allowing non-fast-forward updates. <strong>This can leave unreferenced |
Junio C Hamano | d533bdb | 2009-02-25 09:56:58 | [diff] [blame] | 1076 | commits dangling in the origin repository.</strong> Consider the |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame] | 1077 | following situation, where a fast-forward is not possible: |
Junio C Hamano | d533bdb | 2009-02-25 09:56:58 | [diff] [blame] | 1078 | </p> |
| 1079 | <div class="listingblock"> |
| 1080 | <div class="content"> |
| 1081 | <pre><tt> o---o---o---A---B origin/master |
| 1082 | \ |
| 1083 | X---Y---Z dev</tt></pre> |
| 1084 | </div></div> |
| 1085 | <div class="para"><p>The above command would change the origin repository to</p></div> |
| 1086 | <div class="listingblock"> |
| 1087 | <div class="content"> |
| 1088 | <pre><tt> A---B (unnamed branch) |
| 1089 | / |
| 1090 | o---o---o---X---Y---Z master</tt></pre> |
| 1091 | </div></div> |
| 1092 | <div class="para"><p>Commits A and B would no longer belong to a branch with a symbolic name, |
| 1093 | and so would be unreachable. As such, these commits would be removed by |
| 1094 | a <tt>git gc</tt> command on the origin repository.</p></div> |
| 1095 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1096 | </dl></div> |
Junio C Hamano | 6926bef | 2007-06-16 09:54:05 | [diff] [blame] | 1097 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1098 | <h2 id="_author">Author</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1099 | <div class="sectionbody"> |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1100 | <div class="para"><p>Written by Junio C Hamano <gitster@pobox.com>, later rewritten in C |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1101 | by Linus Torvalds <torvalds@osdl.org></p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1102 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1103 | <h2 id="_documentation">Documentation</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1104 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1105 | <div class="para"><p>Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1106 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1107 | <h2 id="_git">GIT</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1108 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1109 | <div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1110 | </div> |
| 1111 | <div id="footer"> |
| 1112 | <div id="footer-text"> |
Junio C Hamano | dca3482 | 2010-02-13 01:02:52 | [diff] [blame] | 1113 | Last updated 2010-02-13 00:59:51 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1114 | </div> |
| 1115 | </div> |
| 1116 | </body> |
| 1117 | </html> |