Re: Git terminology: remote, add, track, stage, etc.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 19 Oct 2010, Thore Husfeldt wrote:

> 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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]