作者cryinrain (哑猫)
看板Soft_Job
标题[请益] git出现master -> origin
时间Sat Apr 28 14:22:28 2018
新手上路想请教一个问题
不知道为什麽我的git储存库路径後面都会出现master -> origin
https://i.imgur.com/w7CVCYi.png
以前只会有master,如果有修改会变成红色
现在出现master -> origin都不会变色
有什麽办法可以变回只显示master吗?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.39.104.207
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Soft_Job/M.1524896551.A.E86.html
1F:推 CloudyWing: 有remote repository? 04/28 14:56
2F:→ qrtt1: 那就只是跟你说他的上游是谁。(有上游不一定是 remote) 04/28 15:44
我原本也以为是push/pull github後会变这样
可是只要新资料夹git init之後就会出现,remote也没设定
https://imgur.com/6DGumzj.png
现在这样好麻烦
3F:推 abc0922001: 什麽版本阿?我是2.16.2.windows.1 没有这情况 04/28 17:46
4F:→ abc0922001: 我是用 git bash 看的, master 都不会变色 04/28 17:46
5F:推 s860134: 打git remote 看是指到谁 04/28 20:51
我的版本是2.12.2.windows.1,我是用cmder
以前是只有路径後面显示(master),如果有未commit的改动就会显示为红色的master
我觉得这个功能蛮方便的,现在变成这样Q_Q
没有remote也会显示master -> origin
6F:推 abc0922001: 我cmder版本是1.2.9也没这个问题 04/28 22:42
自问自答,我的cmder是1.3.5,在Cmder\vendor\clink-completions\git_prompt.lua中
有一行在搞怪
clink.prompt.value = clink.prompt.value:gsub(escape(branch), '%1 -> '..text)
似乎无论如何都会帮你带上最後的text,无论是有没有remote或上游
把%1後面的注解掉变成
clink.prompt.value = clink.prompt.value:gsub(escape(branch), '%1')
就不会出现後面的 -> origin了
※ 编辑: cryinrain (114.39.107.59), 04/29/2018 12:35:18