Junio C Hamano | 0c04094 | 2005-07-16 00:17:42 -0700 | [diff] [blame] | 1 | <repository>:: |
Jon Loeliger | bccf595 | 2005-11-04 20:36:08 -0600 | [diff] [blame] | 2 | The "remote" repository that is the source of a fetch |
John J. Franey | 5812473 | 2008-05-29 13:32:31 -0400 | [diff] [blame] | 3 | or pull operation. This parameter can be either a URL |
| 4 | (see the section <<URLS,GIT URLS>> below) or the name |
| 5 | of a remote (see the section <<REMOTES,REMOTES>> below). |
Junio C Hamano | ab9b313 | 2005-08-24 16:23:08 -0700 | [diff] [blame] | 6 | |
| 7 | <refspec>:: |
| 8 | The canonical format of a <refspec> parameter is |
Junio C Hamano | 0f4f4d1 | 2008-08-07 16:05:25 -0700 | [diff] [blame] | 9 | `+?<src>:<dst>`; that is, an optional plus `{plus}`, followed |
Jon Loeliger | bccf595 | 2005-11-04 20:36:08 -0600 | [diff] [blame] | 10 | by the source ref, followed by a colon `:`, followed by |
Junio C Hamano | ab9b313 | 2005-08-24 16:23:08 -0700 | [diff] [blame] | 11 | the destination ref. |
Jonas Fonseca | df8baa4 | 2005-10-03 19:16:30 +0200 | [diff] [blame] | 12 | + |
J. Bruce Fields | 3598a30 | 2006-02-05 17:43:47 -0500 | [diff] [blame] | 13 | The remote ref that matches <src> |
Jonas Fonseca | df8baa4 | 2005-10-03 19:16:30 +0200 | [diff] [blame] | 14 | is fetched, and if <dst> is not empty string, the local |
| 15 | ref that matches it is fast forwarded using <src>. |
Jon Loeliger | bccf595 | 2005-11-04 20:36:08 -0600 | [diff] [blame] | 16 | Again, if the optional plus `+` is used, the local ref |
Jonas Fonseca | df8baa4 | 2005-10-03 19:16:30 +0200 | [diff] [blame] | 17 | is updated even if it does not result in a fast forward |
| 18 | update. |
| 19 | + |
Jon Loeliger | bccf595 | 2005-11-04 20:36:08 -0600 | [diff] [blame] | 20 | [NOTE] |
| 21 | If the remote branch from which you want to pull is |
| 22 | modified in non-linear ways such as being rewound and |
| 23 | rebased frequently, then a pull will attempt a merge with |
| 24 | an older version of itself, likely conflict, and fail. |
| 25 | It is under these conditions that you would want to use |
| 26 | the `+` sign to indicate non-fast-forward updates will |
| 27 | be needed. There is currently no easy way to determine |
| 28 | or declare that a branch will be made available in a |
| 29 | repository with this behavior; the pulling user simply |
| 30 | must know this is the expected usage pattern for a branch. |
| 31 | + |
| 32 | [NOTE] |
| 33 | You never do your own development on branches that appear |
| 34 | on the right hand side of a <refspec> colon on `Pull:` lines; |
Jonathan Nieder | ba020ef | 2008-07-03 00:41:41 -0500 | [diff] [blame] | 35 | they are to be updated by 'git-fetch'. If you intend to do |
Junio C Hamano | 4607166 | 2005-11-05 22:26:52 -0800 | [diff] [blame] | 36 | development derived from a remote branch `B`, have a `Pull:` |
| 37 | line to track it (i.e. `Pull: B:remote-B`), and have a separate |
| 38 | branch `my-B` to do your development on top of it. The latter |
| 39 | is created by `git branch my-B remote-B` (or its equivalent `git |
| 40 | checkout -b my-B remote-B`). Run `git fetch` to keep track of |
| 41 | the progress of the remote side, and when you see something new |
| 42 | on the remote branch, merge it into your development branch with |
| 43 | `git pull . remote-B`, while you are on `my-B` branch. |
Jon Loeliger | bccf595 | 2005-11-04 20:36:08 -0600 | [diff] [blame] | 44 | + |
Junio C Hamano | fdd0897 | 2005-11-05 01:37:00 -0800 | [diff] [blame] | 45 | [NOTE] |
| 46 | There is a difference between listing multiple <refspec> |
Jonathan Nieder | ba020ef | 2008-07-03 00:41:41 -0500 | [diff] [blame] | 47 | directly on 'git-pull' command line and having multiple |
Junio C Hamano | fdd0897 | 2005-11-05 01:37:00 -0800 | [diff] [blame] | 48 | `Pull:` <refspec> lines for a <repository> and running |
Jonathan Nieder | ba020ef | 2008-07-03 00:41:41 -0500 | [diff] [blame] | 49 | 'git-pull' command without any explicit <refspec> parameters. |
Junio C Hamano | fdd0897 | 2005-11-05 01:37:00 -0800 | [diff] [blame] | 50 | <refspec> listed explicitly on the command line are always |
| 51 | merged into the current branch after fetching. In other words, |
| 52 | if you list more than one remote refs, you would be making |
Jonathan Nieder | ba020ef | 2008-07-03 00:41:41 -0500 | [diff] [blame] | 53 | an Octopus. While 'git-pull' run without any explicit <refspec> |
Junio C Hamano | fdd0897 | 2005-11-05 01:37:00 -0800 | [diff] [blame] | 54 | parameter takes default <refspec>s from `Pull:` lines, it |
| 55 | merges only the first <refspec> found into the current branch, |
| 56 | after fetching all the remote refs. This is because making an |
| 57 | Octopus from remote refs is rarely done, while keeping track |
| 58 | of multiple remote heads in one-go by fetching more than one |
| 59 | is often useful. |
| 60 | + |
Jonas Fonseca | df8baa4 | 2005-10-03 19:16:30 +0200 | [diff] [blame] | 61 | Some short-cut notations are also supported. |
| 62 | + |
Junio C Hamano | a6080a0 | 2007-06-07 00:04:01 -0700 | [diff] [blame] | 63 | * `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`; |
J. Bruce Fields | 3598a30 | 2006-02-05 17:43:47 -0500 | [diff] [blame] | 64 | it requests fetching everything up to the given tag. |
Jonas Fonseca | df8baa4 | 2005-10-03 19:16:30 +0200 | [diff] [blame] | 65 | * A parameter <ref> without a colon is equivalent to |
J. Bruce Fields | 3598a30 | 2006-02-05 17:43:47 -0500 | [diff] [blame] | 66 | <ref>: when pulling/fetching, so it merges <ref> into the current |
| 67 | branch without storing the remote branch anywhere locally |