Re: how to start with non-master branch?

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

 



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/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]