Re: [PATCH 4/10] Add current branch in PS1 support to git-completion.bash.
- From
Sean <seanlkml@sympatico.ca>
- Date
- Nov 27, 2006, 15:31 UTC
- Message-ID
- <BAYC1-PASMTP02E79ADEE48804655B6FC8AEE60@CEZ.ICE>
- In-Reply-To
- <20061127084128.GD19745@spearce.org>
On Mon, 27 Nov 2006 03:41:28 -0500 "Shawn O. Pearce" <spearce@spearce.org> wrote:
Show 9 quoted lines
> Many users want to display the current branch name of the current git > repository as part of their PS1 prompt, much as their PS1 prompt might > also display the current working directory name. > > We don't force our own PS1 onto the user. Instead we let them craft > their own PS1 string and offer them the function __git_ps1 which they > can invoke to obtain either "" (when not in a git repository) or > "(%s)" where %s is the name of the current branch, as read from HEAD, > with the leading refs/heads/ removed.
Suppose it doesn't hurt to include support for this in git completion scripts. It doesn't look like __git_ps1 is a proper name though, perhaps __git_branch or __git_current_branch would be better?