I am trying to contribute to core as I did the last seven or so years and I need to waste my time on git. This is extremely frustrating. By now, I understand the concept of git repositories and branches (co-located branches do not make any sense but that's git for you) but when I do git clone -b 7.x git://git.drupal.org/project/drupal.git and run git branch -a I see, among others remotes/origin/HEAD -> origin/7.x. Now, that's extremely confusing. To my understanding "origin" was a label we used for a URL push and pull used by default ( as I wrote http://drupal.org/node/1059322/revisions/view/1374826/1388912 here ). What does this has to do with branches? (A branch, to the best my understanding are just labels on a commit with a twist -- they move to the next commit as it happens.) So what is remotes/origin and what is origin, what is the difference and why they are listed in branches?
Comments
Comment #1
chx commentedBTW I created http://drupal.org/node/1137316 as the day progressed to document what I understand of the core repo and how the magic incantations for core are diferent to contrib. Edit: the remotes/origin construct appears there as well and I do not understand that either.
Comment #2
chx commentedI think origin/foo is the foo branch as it is on the origin server ( I *think* ) but ... how does origin/foo differ from remotes/origin/foo?
And just from looking at this mysterious line, did someone set up the Drupal project so that if someone just clones it without specifying anything (that's what HEAD is, isn't it?) then they get 7.x? If so, how can I do it myself? That'd be quite handy for contrib as well.
Comment #3
damien tournoud commented"HEAD" is a symbolic reference, a way to alias references (branches, tags or commits):
http://www.kernel.org/pub/software/scm/git/docs/git-symbolic-ref.html
The mechanism is used for only one thing in Git, as far as I know, to alias "HEAD" to the default branch that gets checked-out when you clone a repository.
Comment #4
damien tournoud commentedOne thing is critical to understand: Git collapses object names ("references") by default, and allows you to use short-hand notations for them.
The exact rules used to resolve symbolic identifiers are described in http://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html
But in a nutshell:
7.xis a short-hand forrefs/heads/7.xif you have a local7.xbranch7.0is a short-hand forrefs/tags/7.xif you have a local7.0tagorigin/7.xis a short-hand forrefs/remotes/origin/heads/7.xComment #5
chx commentedOK. So questions
Comment #6
damien tournoud commentedNo idea why there are two notations in that screen.
Configuring HEAD is the point of #1074960: Let maintainers set a default branch on git repositories.
Comment #7
eliza411 commentedI think this is resolved for sure now that #1074960: Let maintainers set a default branch on git repositories has been deployed. If I'm mistaken, please re-open.