Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | <repository>:: |
| 2 | The "remote" repository that is the source of a fetch |
Junio C Hamano | 054ea08 | 2008-06-01 08:26:34 | [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 | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 6 | |
Junio C Hamano | 9df0c66 | 2009-11-23 11:09:27 | [diff] [blame] | 7 | ifndef::git-pull[] |
| 8 | <group>:: |
| 9 | A name referring to a list of repositories as the value |
| 10 | of remotes.<group> in the configuration file. |
| 11 | (See linkgit:git-config[1]). |
| 12 | endif::git-pull[] |
| 13 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 14 | <refspec>:: |
Junio C Hamano | 45f804f | 2014-06-20 22:24:49 | [diff] [blame] | 15 | Specifies which refs to fetch and which local refs to update. |
| 16 | When no <refspec>s appear on the command line, the refs to fetch |
| 17 | are read from `remote.<repository>.fetch` variables instead |
| 18 | ifndef::git-pull[] |
| 19 | (see <<CRTB,CONFIGURED REMOTE-TRACKING BRANCHES>> below). |
| 20 | endif::git-pull[] |
| 21 | ifdef::git-pull[] |
| 22 | (see linkgit:git-fetch[1]). |
| 23 | endif::git-pull[] |
| 24 | + |
| 25 | The format of a <refspec> parameter is an optional plus |
Junio C Hamano | f7e3f47 | 2017-10-20 06:45:24 | [diff] [blame] | 26 | `+`, followed by the source <src>, followed |
Junio C Hamano | 45f804f | 2014-06-20 22:24:49 | [diff] [blame] | 27 | by a colon `:`, followed by the destination ref <dst>. |
Junio C Hamano | f7e3f47 | 2017-10-20 06:45:24 | [diff] [blame] | 28 | The colon can be omitted when <dst> is empty. <src> is |
| 29 | typically a ref, but it can also be a fully spelled hex object |
| 30 | name. |
Junio C Hamano | 45f804f | 2014-06-20 22:24:49 | [diff] [blame] | 31 | + |
| 32 | `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`; |
| 33 | it requests fetching everything up to the given tag. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 34 | + |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 35 | The remote ref that matches <src> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 36 | is fetched, and if <dst> is not empty string, the local |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame] | 37 | ref that matches it is fast-forwarded using <src>. |
Junio C Hamano | 8b6e23b | 2009-02-01 06:36:08 | [diff] [blame] | 38 | If the optional plus `+` is used, the local ref |
Junio C Hamano | 3f680f3 | 2009-11-16 02:10:54 | [diff] [blame] | 39 | is updated even if it does not result in a fast-forward |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 40 | update. |
| 41 | + |
| 42 | [NOTE] |
Junio C Hamano | 45f804f | 2014-06-20 22:24:49 | [diff] [blame] | 43 | When the remote branch you want to fetch is known to |
| 44 | be rewound and rebased regularly, it is expected that |
| 45 | its new tip will not be descendant of its previous tip |
| 46 | (as stored in your remote-tracking branch the last time |
| 47 | you fetched). You would want |
| 48 | to use the `+` sign to indicate non-fast-forward updates |
| 49 | will be needed for such branches. There is no way to |
| 50 | determine or declare that a branch will be made available |
| 51 | in a repository with this behavior; the pulling user simply |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 52 | must know this is the expected usage pattern for a branch. |
Junio C Hamano | 45f804f | 2014-06-20 22:24:49 | [diff] [blame] | 53 | ifdef::git-pull[] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 54 | + |
| 55 | [NOTE] |
| 56 | There is a difference between listing multiple <refspec> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 57 | directly on 'git pull' command line and having multiple |
Junio C Hamano | 45f804f | 2014-06-20 22:24:49 | [diff] [blame] | 58 | `remote.<repository>.fetch` entries in your configuration |
| 59 | for a <repository> and running a |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 60 | 'git pull' command without any explicit <refspec> parameters. |
Junio C Hamano | 45f804f | 2014-06-20 22:24:49 | [diff] [blame] | 61 | <refspec>s listed explicitly on the command line are always |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 62 | merged into the current branch after fetching. In other words, |
Junio C Hamano | 45f804f | 2014-06-20 22:24:49 | [diff] [blame] | 63 | if you list more than one remote ref, 'git pull' will create |
| 64 | an Octopus merge. On the other hand, if you do not list any |
| 65 | explicit <refspec> parameter on the command line, 'git pull' |
| 66 | will fetch all the <refspec>s it finds in the |
| 67 | `remote.<repository>.fetch` configuration and merge |
| 68 | only the first <refspec> found into the current branch. |
| 69 | This is because making an |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 70 | Octopus from remote refs is rarely done, while keeping track |
| 71 | of multiple remote heads in one-go by fetching more than one |
| 72 | is often useful. |
Junio C Hamano | 7e590a1 | 2013-06-02 23:46:52 | [diff] [blame] | 73 | endif::git-pull[] |