-
-
Save aditya2337/607e01870bfc3a9f90b41587efe89a80 to your computer and use it in GitHub Desktop.
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
gitstatus=`git status 2> /dev/null` | |
if [[ `echo $gitstatus | grep "Changes to be committed"` != "" ]] | |
then | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1***)/' | |
elif [[ `echo $gitstatus | grep "Changes not staged for commit"` != "" ]] | |
then | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1**)/' | |
elif [[ `echo $gitstatus | grep "Untracked"` != "" ]] | |
then | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1*)/' | |
elif [[ `echo $gitstatus | grep "nothing to commit"` != "" ]] | |
then | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
else | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1?)/' | |
fi | |
} | |
# Echo a non-printing color character depending on whether or not the current git branch is the master | |
# Does NOT print the branch name | |
# Use the parse_git_branch() function for that. | |
parse_git_branch_color() { | |
br=$(parse_git_branch) | |
if [[ $br == "(master)" || $br == "(master*)" || $br == "(master**)" || $br == "(master***)" ]]; then | |
echo -e "${blue}" | |
else | |
echo -e "${green}" | |
fi | |
} | |
# No color: | |
#export PS1="@\h:\W\$(parse_git_branch) \$ " | |
# With color: | |
# PS1='${debian_chroot:+($debian_chroot)}\[\033[01;35m\]\u\[\033[01;30m\]@\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
# export PS1="$ps1_blue@\h:$ps1_white\W\[\$(parse_git_branch_color)\]\$(parse_git_branch) $ps1_blue\$$ps1_white " | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
export WORKON_HOME=$HOME/.virtualenvs | |
export PIP_VIRTUALENV_BASE=$HOME/.virtualenvs | |
source $HOME/.env | |
export GOPATH=$HOME/go | |
export PATH=$PATH:$HOME/go/bin:/usr/local/go/bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment