You are not logged in.
If you add this to .bashrc, then it produces a handy visual reminder for which git branch is being worked on. Very useful to not mess with master when you are supposed to be working on a different branch!
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;36m\]\u@\h: \w\[\033[00;31m\]$(parse_git_branch)\[\033[00m\] \$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
I have set mine to use a different colour for the git branch:
damo@debian: ~/github/scripts(testing) $ git status
On branch testing
Your branch is up to date with 'origin/testing'.
damo@debian: ~/github/scripts(testing) $ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
damo@debian: ~/github/scripts(master) $
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
I've added red text in your function, as a warning to myself when in the master branch :8
prompt_git ()
{
git symbolic-ref HEAD &> /dev/null || return 1;
local HEAD="$(git symbolic-ref HEAD 2>/dev/null)";
local BRANCH="${HEAD#refs/heads/}";
if [[ $BRANCH = "master" ]];then
printf '%b(git:%s)' "\033[0;31m" "${BRANCH:-unknown}"
else
printf '%b(git:%s)' "\033[0;32m" "${BRANCH:-unknown}"
fi
}
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline