[Melbourne-pm] Git branches and PS1
Alec Clews
alec.clews at gmail.com
Sun Feb 15 22:47:43 PST 2009
If you have the misfortune to be using Windows, but the good fortune to
have installed Cygwin make the following change to the
git_completions.bash file
__git_ps1 ()
{
[[ $OS == "Windows_NT" && $(stat -f -c %t $PWD) == 4000f ]] &&
return # <== add this
local g="$(git rev-parse --git-dir 2>/dev/null)"
This stops the git search if you are using an SMB network share which is
VERY slow.
NB the magic value 0x4000f was obtained empirically -- YMMV
Make sense?
Toby Corkindale wrote:
> This is a neat feature to use with Git that I only just discovered:
> http://zerokspot.com/weblog/2008/12/04/git-branches-and-ps1/
>
> Essentially, just add $(__git_ps1 " (%s)") to your PS1 in .bashrc, and
> now, if you're inside a directory containing a Git repository, then
> your prompt will include the current branch's name.
>
>
> tobyc at arya:~$ cd git
> tobyc at arya:~/git$ cd webval
> tobyc at arya:~/git/webval (master)$ git checkout
> git-svn master version-0.14
> HEAD user_to_userid
> tobyc at arya:~/git/webval (master)$ git checkout user_to_userid
> Switched to branch "user_to_userid"
> tobyc at arya:~/git/webval (user_to_userid)$
--
Alec Clews
Personal <alec.clews at gmail.com> Melbourne, Australia.
Jabber: alecclews at jabber.org.au PGPKey ID: 0x9BBBFC7C
Blog http://alecthegeek.wordpress.com/
More information about the Melbourne-pm
mailing list