git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Charles Bailey <charles@hashpling.org>
To: Rustom Mody <rustompmody@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: how to start with non-master branch?
Date: Sun, 19 Jul 2009 18:44:41 +0100	[thread overview]
Message-ID: <20090719174441.GA14556@hashpling.org> (raw)
In-Reply-To: <f46c52560907190553x4e21ffbdn6d55c43f2d6b08ad@mail.gmail.com>

On Sun, Jul 19, 2009 at 06:23:32PM +0530, Rustom Mody wrote:
> I want my first commit to be on a non-master branch.
> So after the git init I do
> $ git checkout -b newbranch
> 
> I get
> fatal: You are on a branch yet to be born
> 
> Of course I can get by with making the first commit on master and then
> switching.
> 
> But wondering if I am missing something basic?

The problem with git checkout -b newbranch is that it tries to create
a new branch based on your current HEAD. As you have no commits, your
HEAD doesn't point at a commit ant this can't work. To change the name
of your current branch before you've made any commits, you can use the
symbolic-ref command to update your HEAD to point to a differently
named branch (that also doesn't yet exist). Try this:

git symbolic-ref HEAD refs/heads/non-master

and then carry on adding and committing as before.

Charles.

-- 
Charles Bailey
http://ccgi.hashpling.plus.com/blog/

  parent reply	other threads:[~2009-07-19 17:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-19 12:53 how to start with non-master branch? Rustom Mody
2009-07-19 16:13 ` Dirk Süsserott
2009-07-19 16:19 ` Sean Estabrooks
2009-07-19 17:44 ` Charles Bailey [this message]
2009-07-19 18:26 ` Michael J Gruber

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

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

  git send-email \
    --in-reply-to=20090719174441.GA14556@hashpling.org \
    --to=charles@hashpling.org \
    --cc=git@vger.kernel.org \
    --cc=rustompmody@gmail.com \
    /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.
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 NNTP newsgroup(s).