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

Re: git with detached worktrees , push has no effect

From
Carlos Martín Nieto <cmn@elego.de>
Date
Jul 15, 2011, 19:24 UTC
Message-ID
<1310757899.7308.10.camel@centaur.lab.cmartin.tk>
In-Reply-To
<20110715105640.694fb3ea@shiva.selfip.org>

On Fri, 2011-07-15 at 10:56 +0530, J. Bakshi wrote: [snip]

> Working like a charm and the hook is also working fine. Can we make the 
> empty master branch at the server, so that client can continue with
> plain "git push" ?

You may have figured this out already, but once you push, that branch exists, so under those same rules, pushing to master will work from there onwards.

If you were asking whether you can create an empty branch on the remote you it works "automatically", then the answer is no, because a branch doesn't exist[0] before its first commit. A branch is a reference to a commit (which is, logically, considered the tip of that branch). Thus an empty branch cannot exist before any commits are made to that branch.

[0] For the purposes of network transfer. The way to create the first commit ever in a repo (or in an orphan branch) is to have HEAD point to an as-of-yet nonexistent branch; but this won't help you in this case.

Cheers,
   cmn
Previous: J. Bakshi
Message 5 of 5 in “git with detached worktrees , push has no effect”
  1. J. BakshiJul 14, 2011
  2. Carlos Martín NietoJul 14, 2011
  3. J. BakshiJul 15, 2011
  4. J. BakshiJul 15, 2011
  5. Carlos Martín NietoJul 15, 2011

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.