1.在Mac OS(catalina)中,VSC默认整合是的shell是zsh。我们需要去到VSC的user setting配置文件中,增加以下一条配置:
2.修改bash的配置文件
$ cd ~
$ vi ./.bash_profile
把以下的内容粘贴进入:
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
最后执行一下命令让配置生效:
$ source ./.bash_profile