我正在寻找一个控制台 UI 工具来解决 git 中的合并冲突......就像 vimdiff 但“更容易”
3 回答
我一直使用vimdiff,但我通常只保留要打开的文件可见(:only在此窗口上运行),然后我禁用差异颜色(大多数情况下会伤害眼睛):diffoff。
最后,我有以下映射可以帮助我浏览冲突标记:
nnoremap <space>n /^\(<<<<\\|====\\|>>>>\)<CR>
在普通模式下,按<space>n它将搜索标记,然后使用n从标记转到标记。
从这一点开始,我会编辑我的冲突,直到我满意为止。
The threesome.vim vim plugin provides a friendlier merge tool than vanilla vimdiff.
Regarding the comment about seeing which files are going to change when you git pull: git diff --stat HEAD..origin/$(git rev-parse --abbrev-ref HEAD) after a git fetch will tell you that. (Substitute --name-only for --stat if you really just want the names and nothing else. Or omit --stat altogether to see the actual incoming diffs) You'll likely want to add an alias for this in your global configuration file.
这并不完全是您要寻找的,但git stash对于解决合并非常有帮助。做就是了:
git stash create
git pull
git stash pop <stashnum>
<stashnum>输出从哪里来git stash create