git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: commit 0? (or: create new empty branch)

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 11, 2008, 14:59 UTC
Message-ID
<alpine.LSU.1.00.0803111557130.3873@racer.site>
In-Reply-To
<20080311144515.GB12258@bit.office.eurotux.com>
Hi,
On Tue, 11 Mar 2008, Luciano Rocha wrote:
Show 24 quoted lines
> 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

Previous: Luciano RochaNext: Johannes Sixt
Message 4 of 5 in “commit 0? (or: create new empty branch)”
  1. Luciano RochaMar 11, 2008
  2. Johannes SchindelinMar 11, 2008
  3. Luciano RochaMar 11, 2008
  4. Johannes SchindelinMar 11, 2008
  5. Johannes SixtMar 11, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.