Cool Guy Yo
Cool Guy Yo

Reputation: 6110

#show branch in terminal with .bashrc

I am using the following .bashrc file. The tab completion works fine. However. The second piece of code the #show branch is not being so nice. When I first set it up and sourced it it worked fine. My terminal window it was is at the home location would look something like this [~]$ and when its in a branch something like [direcorty (master)]$ However when I opened a new tab window of terminal it goes back to something like Anders-imac:~ anderskitson$ How do I get the Show branch in status line to stay.

#Git tab completion
source ~/git-completion.bash
# Show branch in status line
PS1='[\W$(__git_ps1 " (%s)")]\$ '
export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~}\007"'

Upvotes: 1

Views: 3687

Answers (2)

Highway of Life
Highway of Life

Reputation: 24321

The reason it's not staying is likely because your terminal is using .bash_profile rather than your .bashrc.

I would create a link to your .bashrc file so that all new terminal windows will use that code from a single .bashrc file:

mv ~/.bash_profile ~/.bash_profile.bak
ln -s ~/.bashrc ~/.bash_profile

mv = move, this will backup your current .bash_profile in case you have something important in there you want to keep. ln -s = create a symbolic link from .bashrc to .bash_profile.

Upvotes: 1

Carl Norum
Carl Norum

Reputation: 224854

Maybe your shells are login shells? If they are, .bashrc doesn't necessarily get read. Try making a similar change in your .bash_profile, or simply source .bashrc from your .bash_profile.

Upvotes: 0

Related Questions