I´ve tried to get GIT to show me the directory and branch I´m working on. So that before I type in anything in GIT, when I´m in a project my command prompt would look something like:
project name (branch name) >
I tried following a tutorial where I was told to make my .bash_profile in my ~ directory look like this:
#export PS1='jjberg '
alias ll='ls -lahG'
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
eval "$(rbenv init -)"
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
export PS1='\W$(__git_ps1 "(%s)") > '
fi
Problem is, whenever I type a command in GIT, an error message is always attached after every action has been performed. It looks like this:
-bash: __git_ps1: command not found
Does anybody have any idea on how I would fix this?
Won't you like to consider using ZSH? it will automatically detect git repositories just like what you want to achieve. It will look like something like this:
lan-chef-cookbooks git:(master) ✗
Btw, I'm using it on Macs but definitely there is a feature of autodetect the repository on other Linux/*nix distros.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.