Last active
July 19, 2017 02:26
-
-
Save aravindkumarsvg/b57795e5019063d93562d1f3aaa25c60 to your computer and use it in GitHub Desktop.
Git prompt for Bash shell
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
# Reference https://gist.github.com/justintv/168835 | |
# Used in Elementery OS terminal | |
# Add to ~/.bashrc file | |
# Sets the Git branch name in the PS1 prompt | |
function git_prompt_setter() { | |
local RED="\\\[\\\033[1;31m\\\]" | |
local NORMAL="\\\[\\\033[00m\\\]" | |
# Modifies the existing prompt and adds the git branch name | |
PS1=$(echo $PS1 | sed 's/\(\\\?[$#]\)\s*$/'"$RED"'\$\(__git_ps1\)'"$NORMAL"'\1 / ' ) | |
} | |
git_prompt_setter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment