![]() When you git fetch, the source references are the other Git's references and the destination ones are yours. The reference before the colon is the source and the reference after the colon is the destination, and this matters because there are two Gits involved in git fetch and git push: yours, and some other Git. ![]() Both git fetch and git push work with refspecs (and both have a -force flag of their own, which effectively adds a + to any refspecs you give on the command line). You can prefix a refspec with a leading plus sign as well this sets the -force flag. For instance, refs/heads/*:refs/remotes/origin/* is a refspec. To keep this short: a refspec is just a pair of references, separated by a colon, and sometimes with one part replaced with *. This explains why you see what you see, but not what happens with git clone -mirror, nor why you can git checkout iOS and suddenly have a new refs/heads/iOS and for that we need two more items, about refspecs (as used with git fetch and git push), and about what Git calls DWIM, or Do What I Mean, in git checkout. When you run git branch -a, Git finds both, and shows the first with refs/heads/ stripped but shows the second with just refs/ stripped. When you run git branch -r, Git finds all your refs/remotes/ references and shows them with refs/remotes/ stripped off. When you run git branch, Git finds all your refs/heads/ reference names and shows them with refs/heads/ stripped off. There are yet more forms of references ( refs/notes/ is for Git's git notes, and GitHub uses refs/pull/ for instance) but branch, tag, and remote-tracking branches are all built in, and standard, and most importantly, highly visible-so you should know about them. To complete this particular list, a tag name like v1.0 is simply a reference whose full name starts with refs/tags/. However, the fact that the name of the remote gets a slash added afterward is tied to the reason you should be careful about using slashes in your remote names.) (The remote part of this is an almost-arbitrary string. The last part, iOS, is something your Git normally copies from another Git. Git also has tags and what Git calls remote-tracking branch names, and these all fall into a general category called references.Ī branch name like master is simply a reference whose full name starts with refs/heads/.Ī remote-tracking branch name like origin/iOS is a reference whose full name starts with refs/remotes/, followed by the name of the remote itself ( origin) and another slash. The first is that while Git has branch names, that's not all that Git has (and for that matter, the term branch is ambiguous: see also What exactly do we mean by "branch"?). ![]() There are a few separate, but intertwined, key concepts here. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |