我在週末升級到了10.9,並且我的bash提示顯示有點時髦。我現在有這在我的.bash_profile
:OS X Mavericks:如果未提交更改,Git bash提示已停止跟蹤
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
PS1="\n\[\e[1;34m\]\$(date +%H:%M) \[\e[1;36m\]\w\[\e[1;33m\] \$(parse_git_branch) \[\e[1;31m\]\$(rvm_version)\n\[\e[0;32m\]> \[\e[0m\]"
unset color_prompt force_color_prompt
這曾經(10.8)產生看起來是這樣的一個提示:
07:45 ~/code/project_dir [git-branch] [email protected]
如果存在需要被提交到我的git變化分支,它會附加星號([git-branch*]
)。
因爲升級,但是,它總是已在*
分支後列出。其他一切似乎都像正常一樣運作。我怎樣才能讓它像以前一樣行事?
我已經更新到最新版本的git。
同樣的問題在http://apple.stackexchange.com/q/111762/7057 –
使用你的代碼在10.8.5下,我也一直得到'*',所以這不是小牛的問題。 – trojanfoe