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