Netbeans 中的 Git - 解决冲突
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10907104/
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
Git in netbeans - resolving conflicts
提问by CodeGuy
I am using Git in netbeans and I wanted to commit my changes, however first I did a pull, and now there are conflicts.
我在 netbeans 中使用 Git 并且我想提交我的更改,但是首先我做了一个 pull,现在出现了冲突。
On the left, I have a .java class that is in red because of conflicts, and I've right clicked it and selected Resolve Conflicts, and went through those steps.
在左侧,我有一个 .java 类,由于冲突而显示为红色,我右键单击它并选择了解决冲突,并完成了这些步骤。
But it still won't let me commit. I would like to override the current HEAD revision with my code, however it won't let me commit. How do I do this?
但它仍然不会让我承诺。我想用我的代码覆盖当前的 HEAD 修订版,但它不会让我提交。我该怎么做呢?
And when I select the file and choose to see Git -> Diff, it only lets me replace or delete the code in my working copy with the code from the HEAD, rather than replace the code in the HEAD.
当我选择文件并选择查看 Git -> Diff 时,它只允许我用 HEAD 中的代码替换或删除工作副本中的代码,而不是替换 HEAD 中的代码。
Basically, I want to commit my code, not revert, etc. How do I do this in netbeans? It keeps telling me I cannot commit because of conflicts.
基本上,我想提交我的代码,而不是还原等。我如何在 netbeans 中做到这一点?它一直告诉我,由于冲突,我无法提交。
采纳答案by Eduardo
I just solved my issue, hope it helps.
我刚刚解决了我的问题,希望它有所帮助。
- 1) Updated to Netbeans 7.1.2 IDE, restarted new IDE.
- 2) Open Git Repository Browser (used a (no branch) local branch) and switch to the branch with the issues both under the Team menu (it will be marked as a no-branch by default, check for the long "Md5 sum" to be the same).
- 3) Pull other needed code from other branches (in case its needed, I had to in my case).
- 4) Now edit/paste the code you want to overwritte. (This will turn the filename to red font).
- 5) Simply right click the file, Git>Resolve Conflicts (and it will do its magic and turn the filename to blue font).
- 6) Commit your local branch and finish.
- 1) 更新到 Netbeans 7.1.2 IDE,重新启动新的 IDE。
- 2)打开Git Repository Browser(使用(无分支)本地分支)并切换到Team菜单下有问题的分支(默认情况下它将被标记为无分支,检查长的“Md5 sum”是一样的)。
- 3)从其他分支中提取其他需要的代码(如果需要,我必须在我的情况下)。
- 4) 现在编辑/粘贴要覆盖的代码。(这会将文件名变成红色字体)。
- 5) 只需右键单击该文件,Git>Resolve Conflicts(它会发挥它的魔力并将文件名变成蓝色字体)。
- 6) 提交本地分支并完成。