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

Re: git branch -a prefixes origin/ branches with remotes/

From
Jay Soffian <jaysoffian@gmail.com>
Date
Mar 31, 2010, 21:59 UTC
Message-ID
<k2r76718491003311459u4bbaeb4ax5b2e550acdd14c88@mail.gmail.com>
In-Reply-To
<18137.1270056387@relay.known.net>
On Wed, Mar 31, 2010 at 1:26 PM, layer <layer@known.net> wrote:
Show 14 quoted lines
> In git 1.6.6.1 & 1.6.3.3, "git branch -a" output is like this
>
> * master
>  remotes/origin/foo
>  ...
>
> instead of like this for 1.6.1.3
>
> * master
>  origin/foo
>  ...
>
> Is this a feature or bug?  I searched the mailing list archives and
> announcements couldn't find any reference to this change.
Feature. Introduced in 1.6.3:
http://article.gmane.org/gmane.comp.version-control.git/116404
See "builtin-branch: improve output when displaying remote branches"
Show 6 quoted lines
> This is important to me because I use the output of "git branch -a" in
> scripts.
>
> I should add that the scripts are merely testing for the existence of
> remote tracking branches in the local repo.  If there's a better way
> to do this, I'm game.  Thanks.

git branch is a so-called porcelain command, and as you've now been bitten by, the output of porcelain's is subject to change.

You probably want git for-each-ref.

Aside, the only list of plumbing vs porcelain commands I'm aware of is in the bash-completion script under contrib. See __git_list_porcelain_commands here:

http://git.kernel.org/?p=git/git.git;a=blob;f=contrib/completion/git-completion.bash

Those are generally commands whose output you do not want to be parsing. All the other git commands installed under git-core are mostly plumbing upon which you can build additional functionality.

(Note to git list: there should be a man page that has a single-line summary of each command and states whether the command is plumbing or porcelain. Maybe there is and I just don't know it.)

j.
Previous: Jakub NarebskiNext: Jeff King
Message 3 of 7 in “git branch -a prefixes origin/ branches with remotes/”
  1. layerMar 31, 2010
  2. Jakub NarebskiMar 31, 2010
  3. Jay SoffianMar 31, 2010
  4. Jeff KingMar 31, 2010
  5. Andreas SchwabMar 31, 2010
  6. Jay SoffianMar 31, 2010
  7. Michael J GruberApr 1, 2010

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.