Re: Git terminology: remote, add, track, stage, etc.
- From
Nicolas Pitre <nico@fluxnic.net>
- Date
- Oct 19, 2010, 19:15 UTC
- Message-ID
- <alpine.LFD.2.00.1010191508370.2764@xanadu.home>
- In-Reply-To
- <0B20EFC4-E613-4D4A-B4F8-8B1750AA8AFD@gmail.com>
On Tue, 19 Oct 2010, Thore Husfeldt wrote:
Show 27 quoted lines
> Also, in the user-manual.txt: > > > Examining branches from a remote repository > > ------------------------------------------- > > > > The "master" branch that was created at the time you cloned is a copy > > of the HEAD in the repository that you cloned from. That repository > > may also have had other branches, though, and your local repository > > keeps branches that track each of those remote branches, which you > > can view using the "-r" option to linkgit:git-branch[1]: > > > > ------------------------------------------------ > > $ git branch -r > > origin/HEAD > > origin/html > > origin/maint > > origin/man > > origin/master > > origin/next > > origin/pu > > origin/todo > > ------------------------------------------------ > > > > You cannot check out these remote-tracking branches, but you can > > examine them on a branch of your own, just as you would a tag: > > That’s just wrong, isn’t it? You absolutely can check out a remote-tracking branch.--
Yes, the above is wrong. But to check out a remote-tracking branch, or a tag, or a random commit through its SHA1, we do rely on the concept of a "detached head". That term and concept has caused newbies grief in the past as well, despite the fact that seasoned Git users are perfectly fine with it.
A detached head is HEAD not being linked to any branch. This is done because tags and remote-tracking branches are not meant to be altered by local changes. Hence committing stuff on top of a detached head will advance HEAD, but no actual branch is keeping a record of it.
Nicolas