git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kevin <ikke@ikke.info>
To: Carlos Pereira <jose.carlos.pereira@ist.utl.pt>
Cc: "Torsten Bögershausen" <tboegi@web.de>, git <git@vger.kernel.org>
Subject: Re: howto to run git without a master branch
Date: Sun, 9 Mar 2014 21:00:25 +0100	[thread overview]
Message-ID: <CAO54GHCALveaT9XSE+SvQLp7a09dy8NvqDc6ajC5TZsFGmFJ_A@mail.gmail.com> (raw)
In-Reply-To: <531CC6FE.2040803@ist.utl.pt>

HEAD on the remote repo is indeed used to determine what to check out
when cloning. It's quite normal to change it to anything you like. To
change it, you usually use git symbolic-ref HEAD master-x instead of
directly editing that file.

On Sun, Mar 9, 2014 at 8:54 PM, Carlos Pereira
<jose.carlos.pereira@ist.utl.pt> wrote:
> On 03/09/2014 07:46 AM, Torsten Bögershausen wrote:
>>>
>>> After creating a local repository with these two branches, and a server
>>> repository with git init --bare, and pushing the two branches:
>>> >  >  git remote add originfoo@bar:~/path/test.git
>>>
>>> >  git push origin master-g
>>> >  git push origin master-x
>>> >  >  everything seems fine, but cloning:
>>> >  git clonefoo@bar:~/path/test.git
>>>
>>> >  terminates with a warning: remote HEAD refers to nonexistent ref,
>>> > unable to checkout.
>>>
>>
>> This is because Git is trying to be nice:
>> When you clone, it tries to checkout a branch for you.
>>
>> What happens when you only have 1 branch, lets say master-x?
>> If I clone the bare repo here, with only 1 branch, this branch
>> is automatically checked out (tested on 1.8.5.2)
>>
>> What happens when you have 2 branches on the server?
>> Git really can not make a decision which one is the right one to check out
>> for
>> you, so if you have 2 branched like "master" and "develop", it checks out
>> the
>> "master" branch for you.
>>
>> But if you have "master-x" and "master-g" then Git has no clue, which one
>> could
>> be you favorite one (and neither have I)
>>
>
> The problem is on the server repo, the cloned repo is just a consequence.
> After initializing the server repo and pushing two branches master-g and
> master-x there is no master branch. Therefore the HEAD file should not point
> to a master branch that does not exist: ref: refs/heads/master
>
> It could point to master-g (the first branch to be pushed) or master-x (the
> last branch to be pushed), depending of the criterion used by git, but
> pointing to something that does not exist seems weird and is the cause of
> the further complaints when the whole repository is cloned...
>
> I forgot to say that the git version is 1.7.2.5 in both the initial repo and
> the server repo (probably this issue was fixed in newer versions?)
>
> As I said, editing directly the HEAD text file on the server, and replacing
> master by master-g (or master-x) seems to solve the problem. My question is:
> is that enough? or shall I expect further issues down the road?
>
> Thank you very much,
>
> Carlos
>
>> What does "git branch" say?
>> (I think nothing)
>> What does "git branch -r" say?
>> (I think "origin/master-g" and "origin/master-x")
>>
>>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-03-09 20:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-08 21:37 howto to run git without a master branch Carlos Pereira
2014-03-09  7:46 ` Torsten Bögershausen
2014-03-09 19:54   ` Carlos Pereira
2014-03-09 20:00     ` Kevin [this message]
2014-03-09 22:16     ` Ilya Bobyr
2014-03-09 23:58       ` Carlos Pereira
2014-03-10  9:30       ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAO54GHCALveaT9XSE+SvQLp7a09dy8NvqDc6ajC5TZsFGmFJ_A@mail.gmail.com \
    --to=ikke@ikke.info \
    --cc=git@vger.kernel.org \
    --cc=jose.carlos.pereira@ist.utl.pt \
    --cc=tboegi@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).