git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* commit 0? (or: create new empty branch)
@ 2008-03-11 12:30 Luciano Rocha
  2008-03-11 12:52 ` Johannes Schindelin
  2008-03-11 13:08 ` Johannes Sixt
  0 siblings, 2 replies; 5+ messages in thread
From: Luciano Rocha @ 2008-03-11 12:30 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 554 bytes --]


Hello,

I'd like to create a new branch, without any pre-existing data, for
purposes similar to git's html/man/.....

However, I've been unable to do that using the higher level tools.

Even starting from an empty git rep, I can't create a branch:

$ git init
Initialized empty Git repository in .git/
$ git branch empty
fatal: Not a valid object name: 'master'.

How were the different git.git branches created?

Regards,
Luciano Rocha

-- 
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: commit 0? (or: create new empty branch)
  2008-03-11 12:30 commit 0? (or: create new empty branch) Luciano Rocha
@ 2008-03-11 12:52 ` Johannes Schindelin
  2008-03-11 14:45   ` Luciano Rocha
  2008-03-11 13:08 ` Johannes Sixt
  1 sibling, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2008-03-11 12:52 UTC (permalink / raw)
  To: Luciano Rocha; +Cc: git

Hi,

On Tue, 11 Mar 2008, Luciano Rocha wrote:

> I'd like to create a new branch, without any pre-existing data, for
> purposes similar to git's html/man/.....

If there is nothing to branch from, there is nothing to branch from.

You might want to rename your branch (once you have something).

But then, I do not even understand why you bother.  You can always push to 
a branch of a different name, and have your principal branch being 
"master" locally.

Hth,
Dscho

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: commit 0? (or: create new empty branch)
  2008-03-11 12:30 commit 0? (or: create new empty branch) Luciano Rocha
  2008-03-11 12:52 ` Johannes Schindelin
@ 2008-03-11 13:08 ` Johannes Sixt
  1 sibling, 0 replies; 5+ messages in thread
From: Johannes Sixt @ 2008-03-11 13:08 UTC (permalink / raw)
  To: Luciano Rocha; +Cc: git

Luciano Rocha schrieb:
> I'd like to create a new branch, without any pre-existing data, for
> purposes similar to git's html/man/.....
> 
> However, I've been unable to do that using the higher level tools.
> 
> Even starting from an empty git rep, I can't create a branch:
> 
> $ git init
> Initialized empty Git repository in .git/
> $ git branch empty
> fatal: Not a valid object name: 'master'.
> 
> How were the different git.git branches created?

There are two ways:

1. Plumbing level

  $ git symbolic-ref HEAD refs/heads/html
  $ rm .git/index
  ...commit new content...

2. Porcelain level

  $ mkdir ../html && cd ../html
  $ git init
  ...commit new content...
  $ cd -   # go back
  $ git fetch ../html master:html

-- Hannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: commit 0? (or: create new empty branch)
  2008-03-11 12:52 ` Johannes Schindelin
@ 2008-03-11 14:45   ` Luciano Rocha
  2008-03-11 14:59     ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Luciano Rocha @ 2008-03-11 14:45 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]

On Tue, Mar 11, 2008 at 01:52:00PM +0100, Johannes Schindelin wrote:
> Hi,
> 
> On Tue, 11 Mar 2008, Luciano Rocha wrote:
> 
> > I'd like to create a new branch, without any pre-existing data, for
> > purposes similar to git's html/man/.....
> 
> If there is nothing to branch from, there is nothing to branch from.
> 
> You might want to rename your branch (once you have something).
> 
> But then, I do not even understand why you bother.  You can always push to 
> a branch of a different name, and have your principal branch being 
> "master" locally.

It's not a matter of pushing/pulling. I'm referring to local branches
only.

What I'd like to have is, using util-linux-ng as an example:

branch master: util-linux-ng plus local patches
branch vendor: util-linux-ng upstream
branch metadata: information on util-linux-ng, how to compile,
    dependencies, etc.

I'd have no problems with the first branches. But when I wanted to
create the third, that shares no files with the others, I stumbled with
the problem of creating a clean branch. I really didn't want to create a
branch them do "git rm .".

Johannes's tricks did the thing. Thank you all.

Regards,
Luciano Rocha

-- 
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: commit 0? (or: create new empty branch)
  2008-03-11 14:45   ` Luciano Rocha
@ 2008-03-11 14:59     ` Johannes Schindelin
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Schindelin @ 2008-03-11 14:59 UTC (permalink / raw)
  To: Luciano Rocha; +Cc: git

Hi,

On Tue, 11 Mar 2008, Luciano Rocha wrote:

> On Tue, Mar 11, 2008 at 01:52:00PM +0100, Johannes Schindelin wrote:
> 
> > On Tue, 11 Mar 2008, Luciano Rocha wrote:
> > 
> > > I'd like to create a new branch, without any pre-existing data, for 
> > > purposes similar to git's html/man/.....
> > 
> > If there is nothing to branch from, there is nothing to branch from.
> > 
> > You might want to rename your branch (once you have something).
> > 
> > But then, I do not even understand why you bother.  You can always 
> > push to a branch of a different name, and have your principal branch 
> > being "master" locally.
> 
> It's not a matter of pushing/pulling. I'm referring to local branches 
> only.
> 
> I'd have no problems with the first branches. But when I wanted to 
> create the third, that shares no files with the others, I stumbled with 
> the problem of creating a clean branch. I really didn't want to create a 
> branch them do "git rm .".
> 
> Johannes's tricks did the thing. Thank you all.

My tricks?

I know, you do not have to reply, but you should have taken a bit more 
care there.

BTW the recommended way is really to go outside and push (slight variation 
on Hannes' 2nd method):

# create new repository
$ mkdir new-root && cd new-root && git init

# initialise master branch
$ vi <file> && git add <file> && git commit <file>

# push it into the original repository as a new branch
$ git push .. master:refs/heads/<new-branch>

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-11 15:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-11 12:30 commit 0? (or: create new empty branch) Luciano Rocha
2008-03-11 12:52 ` Johannes Schindelin
2008-03-11 14:45   ` Luciano Rocha
2008-03-11 14:59     ` Johannes Schindelin
2008-03-11 13:08 ` Johannes Sixt

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).