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

Re: Notation for current branch?

From
ryenus <ryenus@gmail.com>
Date
Aug 30, 2016, 18:09 UTC
Message-ID
<CAKkAvaxyEMjASzfGTqt73AtW7ag-YfqN1yVLEhFreiU-UVdnkA@mail.gmail.com>
In-Reply-To
<xmqqy43f9wzh.fsf@gitster.mtv.corp.google.com>
On 30 August 2016 at 03:49, Junio C Hamano <gitster@pobox.com> wrote:
Show 19 quoted lines
> Jacob Keller <jacob.keller@gmail.com> writes:
>
>>> What's wrong with simply using 'HEAD' for scripting?
>>
>> When you want to display the current branch to the user, e.g. when
>> scripting a shell prompt or similar use
>
> Wait.  Even if a hypothetical version of Git understood @@ as "the
> current branch", how would you use that notation, instead of HEAD,
> to decide what to "display the current branch to the user"?
>
> You obviously will not be doing
>
>         echo @@
>
> You would be doing something around "git symbolic-ref" at the very
> least, and wouldn't you be feeding HEAD to that symbolic-ref anyway
> while doing so?
>

For now the best use case I can think of is with git-reflog, e.g., the meaning of `git reflog HEAD` and `git reflog feature-branch` are quite different, even if I'm currently on the feature-branch, especially when I want to track the rebase histories (if any).

If there's a notation for the current branch then I don't have to find the name of the current branch, then copy/paste it. However, in this case, maybe git-reflog can have a `-b` option to show the reflog of the current branch (if on any)?

- ryenus
Previous: ryenusNext: Junio C Hamano
Message 8 of 9 in “Notation for current branch?”
  1. ryenusAug 28, 2016
  2. Kevin DaudtAug 28, 2016
  3. Jakub NarębskiAug 28, 2016
  4. Jacob KellerAug 29, 2016
  5. Junio C HamanoAug 29, 2016
  6. Jacob KellerAug 29, 2016
  7. ryenusSep 1, 2016
  8. ryenusAug 30, 2016
  9. Junio C HamanoAug 30, 2016

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.