Git branch prompt under Ubuntu not working -
Git branch prompt under Ubuntu not working -
i under ubuntu 12.10, , have installed git-prompt-aware: https://github.com/jimeh/git-aware-prompt
whenever in directory has git repository, need source ~/.bash_profile
show branch. if don't that, doesn't show up. however, when close terminal , go same directory, need 1 time again ~/.bash_profile
, thoughts why can happening?
my problem in .bashrc have defined ps1 as:
case "$term" in xterm-color) color_prompt=yes;; esac # uncomment colored prompt, if terminal has capability; turned # off default not distract user: focus in terminal window # should on output of commands, not on prompt force_color_prompt=yes if [ -n "$force_color_prompt" ]; if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; # have color support; assume it's compliant ecma-48 # (iso/iec-6429). (lack of such back upwards extremely rare, , such # case tend back upwards setf rather setaf.) color_prompt=yes else color_prompt= fi fi if [ "$color_prompt" = yes ]; ps1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else ps1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt # if xterm set title user@host:dir case "$term" in xterm*|rxvt*) ps1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$ps1" ;; *) ;; esac
which overwrites have in .bash_profile:
export gitawareprompt=~/.bash/git-aware-prompt source $gitawareprompt/main.sh export ps1="\u@\h \w\[$txtcyn\]\$git_branch\[$txtylw\]\$git_dirty\[$txtrst\]\$ "
how can combine both of these ps1 settings?
put content of ~/.bash_profile
in ~/.bashrc
. every time start terminal, content of ~/.bashrc
read.
git prompt
Comments
Post a Comment