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

Re: can't create a branch on remote

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Oct 9, 2009, 21:54 UTC
Message-ID
<20091009215436.GA21017@atjola.homenet>
In-Reply-To
<17cb70ee0910091435l4c4d1736hf4d403a2fe6331a2@mail.gmail.com>
On 2009.10.09 23:35:03 +0200, Auguste Mome wrote:
> # git branch mylocal26217  v2.6.21.7

This automatically peels the v2.6.21.7 tag to get the commit object, and creates the new branch head, referencing that commit.

Show 6 quoted lines
> # git push /home/user/dev/git/linux-2.6
>     v2.6.21.7:refs/heads/new_feature_name26217
> Total 0 (delta 0), reused 0 (delta 0)
> error: Trying to write non-commit object
> 170684ef0557d4b711a86595d31dcbebcb9d4ba2 to branch
> refs/heads/new_feature_name26217

This didn't peel the tag, because you might actually want the remote ref to reference the tag, not the commit referenced by the tag. So you tried to create a branch head that would reference a tag, and that is not allowed. To peel the tag you can use: v2.6.21.7^0 v2.6.21.7^{commit} v2.6.21.7^{}

The first two ensure that you actually get a commit object or an error, the last one just peels the tag until it finds a non-tag object.

So:
git push /home/user/dev/git/linux-2.6 \
	v2.6.21.7^0:refs/heads/new_feature_name26217
should do the trick.

Though I don't see why you would create a branch like that. Usually, I'd expect you to create new_feature_name26217 locally, work on it, and then just push that branch head, instead of creating that rather pointless branch head remotely.

Björn
Previous: Auguste MomeNext: Jakub Narebski
Message 2 of 4 in “can't create a branch on remote”
  1. Auguste MomeOct 9, 2009
  2. Björn SteinbrinkOct 9, 2009
  3. Jakub NarebskiOct 9, 2009
  4. Auguste MomeOct 12, 2009

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.