Subject: Re: Newbie grief

From: Rich Pixley <[email-masked]>
Date: Thu, 03 May 2012 11:26:20 -0700

On 5/3/12 09:20 , Hallvard Breien Furuseth wrote:
>   On Thu, 03 May 2012 16:09:15 -0000, Michael Witten wrote:
>> On Thu, 03 May 2012 14:23:59 +0200, Hallvard Furuseth wrote:
>>> I mean 'git clone --bare bar.git foo.git' does not give foo.git
>>> a remote named 'origin' with a branch origin/master.  Not sure
>>> if there is a _simple_ way to do it well either.  init + fetch
>>> above does not try to hardlink objects/packs like clone does.
>>>
>>>> (...)
>>>>    $ git init bar.git; cd bar.git
>>>>    $ echo a>  a; git add a; git commit -m a; cd ..
>>>>    $ git clone --bare bar.git foo.git; cd foo.git
>>>     $ git branch -a
>>>     * master
>>  From `git help clone':
>>
>>    --bare
>>        Make a bare GIT repository. That is, instead of creating
>>        <directory>  and placing the administrative files in
>>        <directory>/.git, make the<directory>  itself the $GIT_DIR.
>>        This obviously implies the -n because there is nowhere to
>>        check out the working tree. Also the branch heads at the
>>        remote are copied directly to corresponding local branch
>>        heads, without mapping them to refs/remotes/origin/. When
>>        this option is used, neither remote-tracking branches nor the
>>        related configuration variables are created.
>   Yes, I know.  I just don't know why.
I do.

It's because creating a string of repositories is a nuisance in git 
because of the remote/foo practice.  You have to manually fetch and 
merge at each location.

In other systems, the branches are tracked identically.  You see master, 
I see master.  The only differences we see are any changes I've created 
that haven't yet been pushed to you or vice verse.  But since git can't 
handle collisions in the repository the way other systems do, it's 
forced to use the geographic branch scheme for non-bare repositories.  
Bare repositories don't have the collision between repository branch and 
working directory copy in git, so with bare repositories, git can use 
the identical branch scheme, (although it still refuses colliding pushes).

If bare repositories used the triangulation approach of non-bare 
repositories, then automation would be considerably more complicated.  
So would repository chaining.

What I don't understand is why git chose this less functional 
architecture over the previously existing practice that doesn't have 
these limitations, although "because that's what BitKeeper did" might be 
the sad answer.

--rich