Mac终端是标签错误显示分支 - Mac Terminal is displaying branch tags incorrectly

- 此内容更新于:2016-02-03
主题:

我只是更新OSX埃尔卡皮坦(错误?),现在我的终端表现异常。每当我在主分支,它显示上面的“主人”标签的文本。同样的,当我切换分支,同样的事情发生(只有“主”被替换为我特性分支)的名字。发生了什么事?

原文:

picture of my terminal

I just updated to OSX El Capitan (mistake?) and my terminal is now behaving strangely. Whenever I'm on my master branch, it displays the "master" tag as the text above. Similarly, when I switch branches, the same thing happens (only "master" is replaced with the name of my feature branch).

What happened?

网友:这只是你的提示,看起来很奇怪。的输出是什么?

(原文:It's just your prompt that looks odd. What is the output of echo "$PS1"?)

楼主:@chepner\n[033年\[0;31m][0m]033[\\W(git_prompt)[033年\[0m]:>

(原文:@chepner \n[\033[0;31m]\W[\033[0m]$(git_prompt)[\033[0m]:>)

网友:不知你的颜色编码没有被解析并显示

(原文:Somehow your color coding is not being parsed and shown as it is)

网友:缺少一些反斜杠,应该。

(原文:It's missing some backslashes; should be \n\[\033[0;31m\]\W\[\033[0m\]$(git_prompt)\[\033[0m\]:>.)

楼主:@chepner知道我如何解决这个问题吗?我很新。

(原文:@chepner Any idea how I'd fix that? I'm very new to this.)

解决方案:
以防有人同样的问题:我没有找到原问题的解决方案,但是我找到了一个解决方案。遵循本文中的指令由马丁·菲茨帕特里克。
原文:

In case anyone has the same issue:

I didn't find the solution to the original problem, but I did find a workaround. Just follow the instructions in this article by Martin Fitzpatrick.