2

符号有什么区别?

在我的一个工作站上,我克隆的 git repo 显示(master),另一个显示(master -> origin)

我还创建了一个新的本地存储库,提交了一个文本文件,提示仍然显示: path (master -> origin)

做一个 git 分支显示唯一的分支是主分支。

我搜索了有关为什么会这样的文档,但我不明白为什么一个与另一个不同。

4

2 回答 2

4

做一个git branch -avv

您应该看到本地 master 分支有一个与之关联的上游分支 origin/master。
这将解释(master -> origin)符号。在“远程分支
中查看更多信息

OP提到使用Cmder。

看着github.com/cmderdev/cmder,我可以看到它正在使用 git-prompt.sh,而这又是 caling git/git/contrib/completion/git-prompt.sh
Agit config -l可能会显示回购之间的差异。
的值GIT_PS1_SHOWUPSTREAM也可能是相关的。

于 2018-02-09T05:38:37.500 回答
1

从 1.3.18 版本开始,您可以修改git_prompt_filter位于 cmder\vendor\clink-completions\git_prompt.lua

这是显示提示的代码

local text = remote_to_push
if (remote_ref) then text = text..'/'..remote_ref end

if (text == '') then
    clink.prompt.value = clink.prompt.value:gsub(escape('('..branch), '%1'..text)
else
    clink.prompt.value = clink.prompt.value:gsub(escape('('..branch), '%1 -> '..text)
end

您可以将其更改为

local text = remote_to_push
if (remote_ref) then text = text..'/'..remote_ref end

clink.prompt.value = clink.prompt.value:gsub(escape('('..branch), '%1'.."")
于 2022-02-04T17:53:20.150 回答