We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
home
cd ~
.bashrc
vi .bashrc
function git_branch { branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`" if [ "${branch}" != "" ];then if [ "${branch}" = "(no branch)" ];then branch="(`git rev-parse --short HEAD`...)" fi echo " ($branch)" fi } export PS1='\u@\h \[\033[01;36m\]\W\[\033[01;32m\]$(git_branch)\[\033[00m\] \$ '
source ./.bashrc
Mac 下面启动的 shell 是 login shell,所以加载的配置文件是.bash_profile,不会加载.bashrc。如果你是 Mac 用户的话,需要再执行下面的命令,这样每次开机后才会自动生效:
.bash_profile
echo "[ -r ~/.bashrc ] && source ~/.bashrc" >> .bash_profile
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在Mac、Linux 终端显示 Git 当前所在分支
home
目录.bashrc
文件The text was updated successfully, but these errors were encountered: