Last active
August 29, 2018 10:05
-
-
Save angel-vladov/753a1f57b4dd8a6573676d8ba8980104 to your computer and use it in GitHub Desktop.
Mac OS terminal prompt with git branch
This file contains hidden or 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
export PATH="/usr/local/bin:$PATH" | |
# Git branch in prompt. | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
PS1='\[\033[32m\]' # change to green | |
PS1="$PS1"'\u@\h ' # user@host<space> | |
PS1="$PS1"'\[\033[33m\]' # change to brownish yellow | |
PS1="$PS1"'\w' # current working directory | |
PS1="$PS1"'\[\033[36m\]' # change color to cyan | |
PS1="$PS1"'$(parse_git_branch 2>/dev/null)' # change color to cyan | |
PS1="$PS1"'\[\033[0m\]' # change color | |
PS1="$PS1"'\n' # new line | |
export PS1="$PS1"'$ ' # prompt: always $ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
source .bash_profile
.Preview (with SMYCK color theme):
