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 | |
Björn Gustavsson | 9c4a036 | 2009-11-09 21:09:56 +0100 | [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 | ab9b313 | 2005-08-24 16:23:08 -0700 | [diff] [blame] | 14 | <refspec>:: |
Marc Branchaud | db4e411 | 2014-06-11 10:24:04 -0400 | [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 |
| 26 | `+`, followed by the source ref <src>, followed |
| 27 | by a colon `:`, followed by the destination ref <dst>. |
| 28 | The colon can be omitted when <dst> is empty. |
Jonas Fonseca | df8baa4 | 2005-10-03 19:16:30 +0200 | [diff] [blame] | 29 | + |
Junio C Hamano | 5cc3268 | 2014-05-29 13:22:01 -0700 | [diff] [blame] | 30 | `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`; |
| 31 | it requests fetching everything up to the given tag. |
| 32 | + |
J. Bruce Fields | 3598a30 | 2006-02-05 17:43:47 -0500 | [diff] [blame] | 33 | The remote ref that matches <src> |
Jonas Fonseca | df8baa4 | 2005-10-03 19:16:30 +0200 | [diff] [blame] | 34 | is fetched, and if <dst> is not empty string, the local |
Felipe Contreras | a75d7b5 | 2009-10-24 11:31:32 +0300 | [diff] [blame] | 35 | ref that matches it is fast-forwarded using <src>. |
Junio C Hamano | 7a0d911 | 2009-01-25 22:25:20 -0800 | [diff] [blame] | 36 | If the optional plus `+` is used, the local ref |
Felipe Contreras | a75d7b5 | 2009-10-24 11:31:32 +0300 | [diff] [blame] | 37 | is updated even if it does not result in a fast-forward |
Jonas Fonseca | df8baa4 | 2005-10-03 19:16:30 +0200 | [diff] [blame] | 38 | update. |
| 39 | + |
Jon Loeliger | bccf595 | 2005-11-04 20:36:08 -0600 | [diff] [blame] | 40 | [NOTE] |
Junio C Hamano | f471dbc | 2014-05-29 12:53:28 -0700 | [diff] [blame] | 41 | When the remote branch you want to fetch is known to |
| 42 | be rewound and rebased regularly, it is expected that |
| 43 | its new tip will not be descendant of its previous tip |
| 44 | (as stored in your remote-tracking branch the last time |
| 45 | you fetched). You would want |
| 46 | to use the `+` sign to indicate non-fast-forward updates |
| 47 | will be needed for such branches. There is no way to |
| 48 | determine or declare that a branch will be made available |
| 49 | in a repository with this behavior; the pulling user simply |
Jon Loeliger | bccf595 | 2005-11-04 20:36:08 -0600 | [diff] [blame] | 50 | must know this is the expected usage pattern for a branch. |
Junio C Hamano | 5d59a32 | 2014-05-29 13:07:44 -0700 | [diff] [blame] | 51 | ifdef::git-pull[] |
Jon Loeliger | bccf595 | 2005-11-04 20:36:08 -0600 | [diff] [blame] | 52 | + |
| 53 | [NOTE] |
Junio C Hamano | fdd0897 | 2005-11-05 01:37:00 -0800 | [diff] [blame] | 54 | There is a difference between listing multiple <refspec> |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [diff] [blame] | 55 | directly on 'git pull' command line and having multiple |
Junio C Hamano | 5d59a32 | 2014-05-29 13:07:44 -0700 | [diff] [blame] | 56 | `remote.<repository>.fetch` entries in your configuration |
| 57 | for a <repository> and running a |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [diff] [blame] | 58 | 'git pull' command without any explicit <refspec> parameters. |
Junio C Hamano | 5d59a32 | 2014-05-29 13:07:44 -0700 | [diff] [blame] | 59 | <refspec>s listed explicitly on the command line are always |
Junio C Hamano | fdd0897 | 2005-11-05 01:37:00 -0800 | [diff] [blame] | 60 | merged into the current branch after fetching. In other words, |
Junio C Hamano | 5d59a32 | 2014-05-29 13:07:44 -0700 | [diff] [blame] | 61 | if you list more than one remote ref, 'git pull' will create |
| 62 | an Octopus merge. On the other hand, if you do not list any |
| 63 | explicit <refspec> parameter on the command line, 'git pull' |
| 64 | will fetch all the <refspec>s it finds in the |
| 65 | `remote.<repository>.fetch` configuration and merge |
| 66 | only the first <refspec> found into the current branch. |
| 67 | This is because making an |
Junio C Hamano | fdd0897 | 2005-11-05 01:37:00 -0800 | [diff] [blame] | 68 | Octopus from remote refs is rarely done, while keeping track |
| 69 | of multiple remote heads in one-go by fetching more than one |
| 70 | is often useful. |
Junio C Hamano | 5d59a32 | 2014-05-29 13:07:44 -0700 | [diff] [blame] | 71 | endif::git-pull[] |