相关疑难解决方法(0)

在我的bash提示符中,$(__ git_ps1)告诉我出了什么问题,但是什么?

我已经攻击了我的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 …

git bash rebase

7
推荐指数
1
解决办法
2447
查看次数

在shell提示符下显示git分支?

我试图让我的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)

我不确定我做错了什么,也许我应该以某种方式'重置'提示?

git branch prompt .bash-profile osx-lion

4
推荐指数
1
解决办法
2765
查看次数

标签 统计

git ×2

.bash-profile ×1

bash ×1

branch ×1

osx-lion ×1

prompt ×1

rebase ×1