Last active
October 22, 2017 01:47
-
-
Save ys-qb/3ca62ff35fbbe260f9150752f9e75376 to your computer and use it in GitHub Desktop.
git prompt : branch only
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see https://coderwall.com/p/fasnya/add-git-branch-name-to-bash-prompt | |
# Terminal colours (after installing GNU coreutils) | |
NM="\[\033[0;38m\]" # means no background and white lines | |
GR="\[\033[0;90m\]" # dark grey | |
HI="\[\033[0;37m\]" # change this for letter colors | |
HII="\[\033[0;31m\]" # change this for letter colors | |
SI="\[\033[0;33m\]" # this is for the current directory | |
IN="\[\033[0m\]" | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1 /' | |
} | |
#export PS1="$NM[ $HI\u $HII\h $SI\w$NM ] $IN" | |
export PS1="$HII\h $SI\w$GR\$(parse_git_branch)$NM] $IN" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment