Skip to content

Instantly share code, notes, and snippets.

@Mikulas
Created May 16, 2011 09:36
Show Gist options
  • Save Mikulas/974148 to your computer and use it in GitHub Desktop.
Save Mikulas/974148 to your computer and use it in GitHub Desktop.
Show git branch in shell prompt
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ →\ \1/'
}
export PS1='\[\e[1;37m\][\u\[\e[1;37m\]@:\[\e[1;36m\]\w\[\e[1;33m\]$(parse_git_branch)\[\e[1;37m\]]$ \[\e[0m\]'
@Mikulas
Copy link
Author

Mikulas commented May 16, 2011

[Mikulas@:~]$ p
[Mikulas@:/Volumes/Data/Projects]$ cd PoleBalanceGPU/
[Mikulas@:/Volumes/Data/Projects/PoleBalanceGPU → tournament-selection]$

@Mikulas
Copy link
Author

Mikulas commented May 16, 2011

Add this to your ~/.bash_profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment