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