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

Re: Why can't git open empty branches ?

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 11, 2012, 10:59 UTC
Message-ID
<20120411105906.GA19823@burratino>
In-Reply-To
<4F855E6B.4010504@danisch.de>
Hadmut Danisch wrote:
Show 6 quoted lines
> when creating a new branch in git, it is by default filled with the
> contents of the current branch.
>
> Sometimes a new but empty branch is needed. There are plenty of
> instructions in the web to achieve this with „dirty tricks”, i.e. fiddle
> around with git's internals.
	git init ../unrelated-topic
	cd ../unrelated-topic
	hack away...
	git commit
	cd -
	git fetch ../unrelated-topic master:<new branch>
Or:
	git checkout --orphan <new branch>
	git rm -fr .
	hack away...

Please feel free to contact the authors of the instructions you found on the web to fix them.

Thanks and hope that helps, Jonathan

Previous: Hadmut DanischNext: Hadmut Danisch
Message 2 of 8 in “Why can't git open empty branches ?”
  1. Hadmut DanischApr 11, 2012
  2. Jonathan NiederApr 11, 2012
  3. Hadmut DanischApr 11, 2012
  4. Matthieu MoyApr 11, 2012
  5. Hadmut DanischApr 11, 2012
  6. Jonathan NiederApr 11, 2012
  7. Matthieu MoyApr 11, 2012
  8. Holger HellmuthApr 11, 2012

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.