我已经攻击了我的bash提示符(理论上)告诉我我目前正在使用什么git分支.但是输出表明出现了问题:
22:07 (seesaw|REBASE-i) infwb $git branch
* master
wkg
Run Code Online (Sandbox Code Playgroud)
这是我的.bash_profile文件中的相关代码(我将在这个问题的最后添加一个更大的部分):
PS1="$GRAY\$(date +%H:%M)\$(__git_ps1) $GREEN\W$YELLOW \$"
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,$(__git_ps1)回报率(seesaw|REBASE-i),即使我不再有一个跷跷板分支!(我确实有一个,它与我在github上的远程跷跷板分支有一个rebase问题.我想,我解决了这个问题,并git branch -r seesaw成功删除了本地副本.)
我很确定这(seesaw|REBASE-i)告诉我有什么不对劲,但我不知道它是什么.
感谢您提出的任何建议.(大块的.bash_profile如下)
-------from .bash_profile ---------
## ----- from http://en.newinstance.it/2010/05/23/git-autocompletion-and-enhanced-bash-prompt/
# Set git autocompletion and PS1 integration
if [ -f /usr/local/git/contrib/completion/git-completion.bash ]; then
. /usr/local/git/contrib/completion/git-completion.bash
fi
if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi
## ----- end
GRAY="\[\033[1;30m\]"
YELLOW="\[\033[1;33m\]"
GREEN="\[\033[0;32m\]"
PS1="$GRAY\$(date +%H:%M)\$(__git_ps1) $GREEN\W$YELLOW \$"
----------------
Run Code Online (Sandbox Code Playgroud)
附录
@cdhowie和@manojlds,我对你的git知识印象深刻!
git rebase --abort导致信息更改为(seesaw).不幸的是,我无法在硬盘上找到rebase-merge …
我试图让我的shell提示符显示当前的git分支名称.
我已经阅读了一些教程和博客文章等,据我所知,我正在做正确的事情,但它似乎没有起作用.
我想提示看起来像这样:
dannys-macbook:hillcrest-store [master]$
Run Code Online (Sandbox Code Playgroud)
但目前它看起来像这样:
dannys-macbook:hillcrest-store danny$
Run Code Online (Sandbox Code Playgroud)
我在〜/ .bash_profile中添加了以下内容:
PATH=$PATH:/usr/local/bin; export PATH
COLOR1="\[\e[1;32m\]"
COLOR2='\[\e[1;1m\]'
COLOR3='\[\e[m\]'
GIT_STATUS=$(__git_ps1 " %s")
PROMPT_CHAR="$"
PROMPT="${COLOR1}\u@\h${COLOR3} \w${COLOR2}${GIT_STATUS} ${COLOR2}${PROMPT_CHAR$
PS1="$PROMPT"
export PS1
Run Code Online (Sandbox Code Playgroud)
我不确定我做错了什么,也许我应该以某种方式'重置'提示?