![]() ![]() (A leading plus sign + would tell Git to force-update the local reference even if fast-forwarding would fail, but you omit the local reference in the first place, so there's nothing for the + force flag to affect.) Since you don't have the : and destination, the part is empty, and no local reference is fast-forwarded. The remote ref that matches is fetched, and if is not empty string, the local ref that matches it is fast-forwarded using. The format of a parameter is an optional plus +, followed by the source, followed by a colon `:`, followed by the destination ref. Specifies which refs to fetch and which local refs to update. Since we're only concerned with git fetch, let's see what it means there, which is: This is still a valid refspec, but what it means is different in git fetch and git push. There is no colon there is no second name. You are using the simplest: a single name, master. Now, I said above that a pair of names is the second simplest form of refspec. Which would direct your Git to copy their (local to them, and quite normal) branch normalbranch to a local reference in your own repository named refs/strangeref. You could, for instance, write: git fetch origin +refs/heads/normalbranch:refs/strangeref When you give git fetch origin additional arguments, they are refspecs, just like this fetch setting. This would direct Git to obtain all branches (all refs/heads/ names), and copy them to remote-tracking names in your own repository. Without -single-branch, Git would have used the default refspec, fetch=+refs/heads/*:refs/remotes/origin/*. When you run git fetch origin with no additional arguments, your Git performs this default action. This tells your Git that when it contacts the other Git at origin, the default action is to fetch only their branch my-branch, copying the result to your remote-tracking name origin/my-branch. =+refs/heads/my-branch:refs/remotes/origin/my-branch (Note: the additional my-branch argument winds up being treated as a directory name.) Running: git config -list -local This changes the fetch refspecs associated with the new clone. ![]() When you make a -single-branch clone: git clone -single-branch -branch my-branch (The - is pointless here.) The git fetch command treats origin as the name of the repository (so it looks up the URL associated with origin, and the fetch = refspecs associated with origin), and then treats master as a refspec, to combine with and partly override any previously-defined fetch refspecs. The name on the left is the source, and the name on the right is the destination (which the Git documentation abbreviates as and ).Ĭonsider, then, your command: git fetch origin - master The references can be abbreviated in some cases, e.g., master:master. A refspec, in its second-simplest form, is a pair of references separated by a colon, such as refs/heads/master:refs/heads/master. Depending on the combination used, you might want to fetch into refs/remotes/origin/master and run git merge origin/master, for instance. specify a destination reference name in your git fetch refspec, or. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |