Created
September 21, 2011 03:00
-
-
Save Royce/1231106 to your computer and use it in GitHub Desktop.
.bash_profile file used at work for Git Bash on windows
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
function set_window_title | |
{ | |
local title="$1" | |
if [[ -z "$title" ]]; then | |
title="root" | |
fi | |
# Set window title | |
echo -n -e "\033]0;${title}\a" | |
} | |
PROMPT_COMMAND='set_window_title "${PWD##*/}"' | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(\1$(parse_git_dirty))/" | |
} | |
export PS1="\[\033[01;32m\]\h\[\033[00m\]: \[\033[01;36m\]\w\[\033[00m\] \[\033[01;37m\]\$(parse_git_branch)\[\033[00m\] " | |
case `id -u` in | |
0) PS1="${PS1}# ";; | |
*) PS1="${PS1}$ ";; | |
esac | |
alias projects='cd /c/Users/229171k/Projects' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment