Skip to content

Instantly share code, notes, and snippets.

@mdaley
Created July 22, 2014 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdaley/efe51dff8cb92265b637 to your computer and use it in GitHub Desktop.
Save mdaley/efe51dff8cb92265b637 to your computer and use it in GitHub Desktop.
Git bash prompt
This sorts out the problem of lines not wrapping properly.
export PS1='\[\e]0;\u@\h: \w\a\]\[\e[32;1m\]${debian_chroot:+($debian_chroot)}\u@\h:\w \[\e[33;1m\]$(__git_ps1 "[%s] ")\[\e[32;1m\]\$ \[\e[0m\]'
Copy exactly into your .bashrc. Note that __git_ps1 is a builtin (comes with git I assume) feature that provides the branch you are on if you are in a git area. There's no need for a separate function to obtain this information.
Read this page if interested about what all the funny, cryptic characters are all about:
http://www.ibm.com/developerworks/linux/library/l-tip-prompt/
(and to change the colours and background if you want to.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment