Skip to content

Instantly share code, notes, and snippets.

@svenliebig
Created July 17, 2017 12:24
Show Gist options
  • Save svenliebig/82a02bb0caaa49952336b5da749284ba to your computer and use it in GitHub Desktop.
Save svenliebig/82a02bb0caaa49952336b5da749284ba to your computer and use it in GitHub Desktop.
git_branch() {
echo -n ' => (' && git branch 2>/dev/null | grep '^*' | colrm 1 2 | tr -d '\n' && echo -n ')]'
}
git_project_name() {
echo -n '[' && git config --local remote.origin.url|sed -n 's#.*/\([^.]*\)\.git#\1#p' | tr -d '\n'
}
git_string() {
echo -n '' && git_project_name && git_branch
}
git_string_cutted() {
git_string | sed 's/\[ => ()]//'
}
export PS1="\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\] \033[0;31m \$(git_string_cutted) \033[0m \n\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment