Last active
December 6, 2019 18:48
-
-
Save automagicaly/46c906cbb6024f1c8296fcce9c3db4b4 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
############################################# | |
# Functions | |
############################################# | |
get_git_branch(){ | |
# Based on: http://stackoverflow.com/a/13003854/170413 | |
local branch | |
if branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null); then | |
if [[ "$branch" == "HEAD" ]]; then | |
branch='detached* ' | |
fi | |
symbol=$'\ue725' | |
#git_branch="($symbol $branch) " | |
git_branch="($branch) " | |
else | |
git_branch="" | |
fi | |
} | |
############################################# | |
# Exports | |
############################################# | |
PROMPT_COMMAND="get_git_branch; $PROMPT_COMMAND" | |
export PS1="\W \[\e[33m\]\$git_branch\[\e[32m\]➤\[\e[0m\] " | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment