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

git-push and $GIT_DIR/branches

From
MKMartin Koegler <mkoegler@auto.tuwien.ac.at>
Date
Nov 7, 2008, 08:26 UTC
Message-ID
<20081107082629.GA27158@auto.tuwien.ac.at>

I think, that the git-push behaviour is a bit unlogical in conjunction with $GIT_DIR/branches.

If $GIT_DIR/branches/name1 contains "<repository>#name2":
- git-fetch name1
  will fetch refs/heads/name2 from <repository> and store it in refs/heads/name1
- git-push name1
  will push refs/heads/master to refs/heads/master in <repository>

I would expect, that git-push would somehow honour #name2. As far as I remember, cg-push name1 would have pushed HEAD to refs/heads/name2 in <repository>.

In remote.c, function read_branches_file the following code
would implement a similar behaviour:
        strbuf_init(&push, 0);
        strbuf_addstr(&push, "HEAD");
        if (frag) {
                strbuf_addf(&push, ":refs/heads/%s", frag);
        } else
                strbuf_addstr(&push, ":refs/heads/master");
        add_push_refspec(remote, strbuf_detach(&push, 0));
Options about this?
mfg Martin Kögler
Next: Martin Koegler
Message 1 of 3 in “git-push and $GIT_DIR/branches”
  1. Martin KoeglerNov 7, 2008
  2. Martin KoeglerNov 7, 2008
  3. Junio C HamanoNov 7, 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.