From: Sean Date: Mon, 27 Nov 2006 12:56:50 GMT Subject: Re: git-PS1 bash prompt setting Message-ID: In-Reply-To: <20061127065400.GA19174@spearce.org> On Mon, 27 Nov 2006 01:54:00 -0500 Shawn Pearce wrote: > I'm using something like this, and will be adding it to > git-completion.bash tonight: > > __git_ps1 () > { > local b="$(git symbolic-ref HEAD 2>/dev/null)" > if [ -n "$b" ]; then echo "(${b##refs/heads/})"; fi > } > PS1='[\u@\h \W$(__git_ps1)]\$ ' > > it works very well... Yeah, when I first coded it I even looked at making it a bash loadable to make it perform better but found the prototype to run acceptably, so never bothered. If Git does get a --show-ps1 option, people will still be able to roll their own version to tweak the output format as you did above. Hopefully the standard format will work for most though.