Last active
May 15, 2019 13:38
-
-
Save M1ke/eaed6d0dd662edd9477f to your computer and use it in GitHub Desktop.
Handy stuff in my .bashrc
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
# Taken from https://github.com/NotBobTheBuilder/dotfiles/blob/9dfb79548eab93c5b048b7ac535c53cee8db47f0/.bash_aliases | |
# Relies on .bash_colors also from the same file | |
IRed="\[\033[0;91m\]" # Red | |
Green="\[\033[0;32m\]" # Green | |
Color_Off="\[\033[0m\]" # Text Reset | |
export PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(git branch &>/dev/null;\ | |
if [ $? -eq 0 ]; then \ | |
echo "$(echo `git status` | grep "Changes" > /dev/null 2>&1; \ | |
if [ "$?" -eq "0" ]; then \ | |
# @5 - Changes to working tree | |
echo "'$IRed'"$(__git_ps1 " {%s}"); \ | |
else \ | |
# @4 - Clean repository - nothing to commit | |
echo "'$Green'"$(__git_ps1 " (%s)"); \ | |
fi) '$Color_Off'\$ "; \ | |
else \ | |
# @2 - Prompt when not in GIT repo | |
echo " '$Color_Off'\$ "; \ | |
fi)' | |
case "$TERM" in | |
xterm*|rxvt*) | |
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" | |
;; | |
*) | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stolen from Jack Wearden who probably stole it from somewhere else. I've remove the requirement to have lots of colours defined, and also changed what it classifies as clean (untracked files won't make it "unclean").