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

Re: git branch --current?

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Mar 17, 2010, 15:04 UTC
Message-ID
<fcaeb9bf1003170804s4c9fdbb6id2c045bdb90f8c6f@mail.gmail.com>
In-Reply-To
<76718491003170748h349c5ed0u7649864cc824f549@mail.gmail.com>
On 3/17/10, Jay Soffian <jaysoffian@gmail.com> wrote:
Show 13 quoted lines
> On Wed, Mar 17, 2010 at 10:43 AM, Nguyen Thai Ngoc Duy
>  <pclouds@gmail.com> wrote:
>  > I use "git branch" when I need to know the current branch. But I have
>  > many branches, looking for the star is "time consuming". I'd rather
>  > have something like pwd, just print the current branch name and that's
>  > all. A bit more information about current branch wouldn't hurt, as
>  > long as the branch name is printed at a fixed location.
>  >
>  > What command do you use to know what branch you are on?
>
>
> Doesn't everyone who's anyone put it in their prompt with the bash
>  completion script? :-)

Me obviously :-) But bash is not the one true shell. I need to use csh sometimes.

>  Well, if not, how about a simple alias:
>
>  pwb = rev-parse --abbrev-ref HEAD

Hmm.. I have alias.pwb = symbolic-ref HEAD. Both solutions are not as good as "git branch", say detached HEAD case.

-- 
Duy
Previous: Jay SoffianNext: Jay Soffian
Message 3 of 6 in “git branch --current?”
  1. Nguyen Thai Ngoc DuyMar 17, 2010
  2. Jay SoffianMar 17, 2010
  3. Nguyen Thai Ngoc DuyMar 17, 2010
  4. Jay SoffianMar 17, 2010
  5. David AguilarMar 17, 2010
  6. Nguyen Thai Ngoc DuyMar 18, 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.