Re: how to start with non-master branch?

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

 



On Sun, 19 Jul 2009 18:23:32 +0530
Rustom Mody <rustompmody@xxxxxxxxx> wrote:

Hi Rustom,

> 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

No branches exist in a new repository that you've just init'ed.  If you run
"git branch" you'll see that no branches are listed.  You must make an
initial commit before a branch will be "born".   Since "git checkout"
needs you to supply a branch/commit to operate, you can't use it to create
the first branch in a repo.

When you make the initial commit in a repo the HEAD reference will
determine which branch is created.   So the following ugly looking
command will allow you to change the name to something other than 
master before making your first commit:

	$ git symbolic-ref HEAD refs/heads/newbranch

> Of course I can get by with making the first commit on master and then
> switching.

That is probably the simplest thing to do, rename master after the initial
commit:

	$ git commit -m "initial commit"
	$ git branch -m newbranch

HTH,
Sean
--
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]