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

git branch -a now reports 'remotes/foo' rather than 'foo'?

From
Daniel Pittman <daniel@rimspace.net>
Date
May 11, 2009, 02:16 UTC
Message-ID
<87skjcpeno.fsf@rimspace.net>

G'day. Debian recently released git 1.6.3 to unstable, so it has just landed on my desk, and a change in the output of 'git branch' listings is causing one of the front-ends I use to fail.

In previous versions, in a git-svn repository, I got this output to 'git branch -a':

,----[ git 1.6.2 and earlier ]
| ] git branch -a
| * master
|   tags/16-1
|   tags/18-1
|   tags/19-2
|   trunk
`----
Now, in 1.6.3, I see two different output formats:
,----[ git 1.6.3 ]
| ] git branch -a
| * master
|   remotes/tags/16-1
|   remotes/tags/18-1
|   remotes/tags/19-2
|   remotes/trunk
| ] git branch -r
|   tags/16-1
|   tags/18-1
|   tags/19-2
|   trunk
`----

The front-end I am using looks for a 'trunk' branch by name in the output of 'git branch -a', which historically worked. Now, though, it shows that fully qualified.

Looking at the release notes it looks like this was a deliberate change, from this entry:

* "git-branch -r" shows HEAD symref that points at a remote branch in
  interest of each tracked remote repository.

However, that isn't unambiguously clear about the change, and is pretty light on the "why" parts. Worse, the only discussion I can find about the change suggests that this was noticed, and there wasn't real clarity about the background.

(See Jeff King under "[PATCH 1/2] add basic branch display tests" at [1]
 for the details.)

I confess, to me, that having 'git branch -a' and 'git branch -r' emit different values doesn't make much sense, but I suppose the upstream code can be adapted.

I wanted to confirm that this was a deliberate change before I went to the trouble or rewriting the front-end code however.

Regards,
        Daniel
Footnotes: 
[1]  http://thread.gmane.org/gmane.comp.version-control.git/110564/focus=110616
Next: Jay Soffian
Message 1 of 3 in “git branch -a now reports 'remotes/foo' rather than 'foo'?”
  1. Daniel PittmanMay 11, 2009
  2. Jay SoffianMay 11, 2009
  3. Daniel PittmanMay 11, 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.