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

Re: git branch command is incompatible with bash

From
SSScott Schmit <i.grok@comcast.net>
Date
Jul 29, 2015, 00:23 UTC
Message-ID
<20150729002333.GB23501@odin.ulthar.us>
In-Reply-To
<xmqq4mkogvb7.fsf@gitster.dls.corp.google.com>
On Tue, Jul 28, 2015 at 08:23:40AM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> Johannes Sixt <j6t@kdbg.org> writes:
> > Are you trying to say that the result of 'rev-parse --abbrev-ref HEAD'
> > is suboptimal and that of 'symbolic-ref --short HEAD' is OK?
> 
> My "Interesting" was primarily about that I wasn't aware of the
> "--abbrev-ref" option.
> 
> Yes, I am sure some time ago I accepted a patch to add it, but I
> simply do not see the point, especially because the "--short" option
> to symbolic-ref feels much more superiour.  "What branch am I on?"
> is about symbolic refs, rev-parse is about revisions.

Sometimes my question is "what branch am I on?" -- in which case symbolic-ref is adequate.

Other times, my question is "where am I/what did I check out?" which is usually a branch, sometimes a tag, and sometimes a commit hash. We don't have a one-stop-shop command to answer that question in all cases, which is unfortunate.

git status answers, but that's not plumbing. git-prompt manages to do a fairly good job, but the logic is by no means straightforward.

-- 
Scott Schmit
Previous: Johannes Sixt
Message 9 of 9 in “git branch command is incompatible with bash”
  1. Anatol RudolphJul 27, 2015
  2. Johannes SixtJul 27, 2015
  3. Junio C HamanoJul 27, 2015
  4. Johannes SixtJul 28, 2015
  5. Jakub NarębskiJul 28, 2015
  6. Junio C HamanoJul 28, 2015
  7. Jeff KingJul 28, 2015
  8. Johannes SixtJul 28, 2015
  9. Scott SchmitJul 29, 2015

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.