Re: how to start with non-master branch?
- From
Charles Bailey <charles@hashpling.org>
- Date
- Jul 19, 2009, 17:44 UTC
- Message-ID
- <20090719174441.GA14556@hashpling.org>
- In-Reply-To
- <f46c52560907190553x4e21ffbdn6d55c43f2d6b08ad@mail.gmail.com>
On Sun, Jul 19, 2009 at 06:23:32PM +0530, Rustom Mody wrote:
Show 11 quoted lines
> 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/