Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/Documentation/pull-fetch-param.adoc # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / Documentation / pull-fetch-param.adoc` 121 lines ยท 5632 bytes Raw Blame History 1 __:: 2 The "remote" repository that is the source of a fetch 3 or pull operation. This parameter can be either a URL 4 (see the section <> below) or the name 5 of a remote (see the section <> below). 6 7 ifndef::git-pull[] 8 __:: 9 A name referring to a list of repositories as the value 10 of `remotes.` in the configuration file. 11 (See linkgit:git-config[1]). 12 endif::git-pull[] 13 14 [[fetch-refspec]] 15 __:: 16 Specifies which refs to fetch and which local refs to update. 17 When no ____s appear on the command line, the refs to fetch 18 are read from `remote..fetch` variables instead 19 ifndef::git-pull[] 20 (see <> below). 21 endif::git-pull[] 22 ifdef::git-pull[] 23 (see the section "CONFIGURED REMOTE-TRACKING BRANCHES" 24 in linkgit:git-fetch[1]). 25 endif::git-pull[] 26 + 27 The format of a __ parameter is an optional plus 28 `+`, followed by the source __, followed 29 by a colon `:`, followed by the destination __. 30 The colon can be omitted when __ is empty. __ is 31 typically a ref, or a glob pattern with a single `*` that is used 32 to match a set of refs, but it can also be a fully spelled hex object 33 name. 34 + 35 A __ may contain a `*` in its __ to indicate a simple pattern 36 match. Such a refspec functions like a glob that matches any ref with the 37 pattern. A pattern __ must have one and only one `*` in both the __ and 38 __. It will map refs to the destination by replacing the `*` with the 39 contents matched from the source. 40 + 41 If a refspec is prefixed by `^`, it will be interpreted as a negative 42 refspec. Rather than specifying which refs to fetch or which local refs to 43 update, such a refspec will instead specify refs to exclude. A ref will be 44 considered to match if it matches at least one positive refspec, and does 45 not match any negative refspec. Negative refspecs can be useful to restrict 46 the scope of a pattern refspec so that it will not include specific refs. 47 Negative refspecs can themselves be pattern refspecs. However, they may only 48 contain a __ and do not specify a __. Fully spelled out hex object 49 names are also not supported. 50 + 51 `tag ` means the same as `refs/tags/:refs/tags/`; 52 it requests fetching everything up to the given tag. 53 + 54 The remote ref that matches __ 55 is fetched, and if __ is not an empty string, an attempt 56 is made to update the local ref that matches it. 57 + 58 Whether that update is allowed without `--force` depends on the ref 59 namespace it's being fetched to, the type of object being fetched, and 60 whether the update is considered to be a fast-forward. Generally, the 61 same rules apply for fetching as when pushing, see the `...` 62 section of linkgit:git-push[1] for what those are. Exceptions to those 63 rules particular to `git fetch` are noted below. 64 + 65 Until Git version 2.20, and unlike when pushing with 66 linkgit:git-push[1], any updates to `refs/tags/*` would be accepted 67 without `+` in the refspec (or `--force`). When fetching, we promiscuously 68 considered all tag updates from a remote to be forced fetches. Since 69 Git version 2.20, fetching to update `refs/tags/*` works the same way 70 as when pushing. I.e. any updates will be rejected without `+` in the 71 refspec (or `--force`). 72 + 73 Unlike when pushing with linkgit:git-push[1], any updates outside of 74 `refs/{tags,heads}/*` will be accepted without `+` in the refspec (or 75 `--force`), whether that's swapping e.g. a tree object for a blob, or 76 a commit for another commit that doesn't have the previous commit as 77 an ancestor etc. 78 + 79 Unlike when pushing with linkgit:git-push[1], there is no 80 configuration which'll amend these rules, and nothing like a 81 `pre-fetch` hook analogous to the `pre-receive` hook. 82 + 83 As with pushing with linkgit:git-push[1], all of the rules described 84 above about what's not allowed as an update can be overridden by 85 adding an optional leading `+` to a refspec (or using the `--force` 86 command line option). The only exception to this is that no amount of 87 forcing will make the `refs/heads/*` namespace accept a non-commit 88 object. 89 + 90 [NOTE] 91 When the remote branch you want to fetch is known to 92 be rewound and rebased regularly, it is expected that 93 its new tip will not be a descendant of its previous tip 94 (as stored in your remote-tracking branch the last time 95 you fetched). You would want 96 to use the `+` sign to indicate non-fast-forward updates 97 will be needed for such branches. There is no way to 98 determine or declare that a branch will be made available 99 in a repository with this behavior; the pulling user simply 100 must know this is the expected usage pattern for a branch. 101 ifdef::git-pull[] 102 + 103 [NOTE] 104 There is a difference between listing multiple __ 105 directly on `git pull` command line and having multiple 106 `remote..fetch` entries in your configuration 107 for a __ and running a 108 `git pull` command without any explicit __ parameters. 109 ____s listed explicitly on the command line are always 110 merged into the current branch after fetching. In other words, 111 if you list more than one remote ref, `git pull` will create 112 an Octopus merge. On the other hand, if you do not list any 113 explicit __ parameter on the command line, `git pull` 114 will fetch all the ____s it finds in the 115 `remote..fetch` configuration and merge 116 only the first __ found into the current branch. 117 This is because making an 118 Octopus from remote refs is rarely done, while keeping track 119 of multiple remote heads in one-go by fetching more than one 120 is often useful. 121 endif::git-pull[]