Windows 上的 Git GUI:合并冲突

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38754631/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 04:26:53  来源:igfitidea点击:

Git GUI on Windows: merging conflicts

gitmerge-conflict-resolutiongit-gui

提问by Merik

I am fluent with Git on the command line but for a specific project, I need to show others how to do things exclusively in the GUI environment. We are using Git for Windows (available at https://git-scm.com/download/win).

我在命令行上精通 Git,但对于特定项目,我需要向其他人展示如何专门在 GUI 环境中执行操作。我们在 Windows 上使用 Git(可从https://git-scm.com/download/win 获得)。

I created a file and added to the repository. Then had another user modify the file and push it. I also modified the file, then I fetched the repository from origin, and used "Merge > Local Merge" menu to show how Git GUI finds the conflicts.

我创建了一个文件并添加到存储库中。然后让另一个用户修改文件并推送它。我还修改了文件,然后我从源中获取了存储库,并使用“合并 > 本地合并”菜单来显示 Git GUI 如何找到冲突。

Then I manually edited the text file and resolved the conflict by cherry-picking some of my changes and some of those by the other user. At this stage, if it was command line I would do git add. In the GUI you are supposed to do the same thing using the "Stage Changed" button, I presume, but when I press the button it doesn't actually stage the changed file.

然后我手动编辑文本文件并通过挑选我的一些更改和其他用户的一些更改来解决冲突。在这个阶段,如果是命令行,我会做git add. 在 GUI 中,您应该使用“Stage Changed”按钮来做同样的事情,我想,但是当我按下按钮时,它实际上并没有暂存已更改的文件。

I cannot find any online documentation for the GUI program that discusses merge conflict resolution. Can anyone please tell me what the next step would be in the GUI environment?

我找不到讨论合并冲突解决方案的 GUI 程序的任何在线文档。谁能告诉我 GUI 环境中的下一步是什么?

回答by Merik

I found the answer. As annoying as it is, when you are doing anything other than conflict resolution, the Stage Changedbutton does what the git addcommand would do. But if you are resolving conflicts, you should not use that button (it actually doesn't work); instead you should use the following menu: Commit > Stage To Commit. The keyboard shortcut is CTRL+T.

我找到了答案。尽管很烦人,但当您执行除冲突解决以外的任何操作时,该Stage Changed按钮git add会执行命令会执行的操作。但是如果你正在解决冲突,你不应该使用那个按钮(它实际上不起作用);相反,您应该使用以下菜单:Commit > Stage To Commit. 键盘快捷键是CTRL+T

In fact the Stage Changedbutton is equivalent to the menu option Commit > Stage Changed Files to Commit.

实际上Stage Changed按钮就相当于菜单选项Commit > Stage Changed Files to Commit