由于 Netbeans 中的这些文件,head 与 origin/master 的 git 合并失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13557136/
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 merge of head with origin/master failed because of these files in Netbeans
提问by David Sonnenfeld
We are working with Netbeans and sometimes get an error when pulling/pushing from git
我们正在使用 Netbeans,从 git 拉/推时有时会出错
git merge of head with origin/master failed because of these files: ".../Filename.java"
由于这些文件,head 与 origin/master 的 git 合并失败:“.../Filename.java”
What can we do? How to solve this in netbeans? We tried everything -> commit -> pull - same error -> commit -> push - same error
我们可以做什么?如何在netbeans中解决这个问题?我们尝试了所有 -> 提交 -> 拉取 - 同样的错误 -> 提交 -> 推送 - 同样的错误
no windows showing up where we can resolve the conflicts.
没有窗口显示我们可以解决冲突的地方。
Edit:When I do: git pull with the git shell, then it works, the file will show me the conflict...
编辑:当我这样做时: git pull 与 git shell,然后它工作,文件将向我显示冲突......
But if I do the git pull via netbeans, netbeans doesnt show me anything, it keeps the file as it is without putting
但是,如果我通过 netbeans 执行 git pull,netbeans 不会向我显示任何内容,它会保持文件原样而不放置
<<<<<< HEAD:file.java
blablabla
========
blabla
>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.java
inside.
里面。
采纳答案by mgarciaisaia
I'd guess that file wasn't tracked, and you created it at the same time another one created it and commited it to your remote.
我猜那个文件没有被跟踪,你在创建它的同时另一个人创建了它并将它提交到你的遥控器。
I'd suggest you to create a stash
, pull
changes, and then stash pop
. It would probably create a conflict (as you're saying), but it can be addressed with Netbeans' merge editor.
我建议您创建一个stash
,pull
更改,然后stash pop
. 它可能会产生冲突(如您所说),但可以使用 Netbeans 的合并编辑器来解决。
Just resolve the conflict and you're done.
只要解决冲突,你就完成了。
Alternatively, you can commit your file locally, and then fetch
+ rebase
onto origin/master
(or whichever your remote branch is). You'll get the conflict again, it's almost the same as the first option.
或者,您可以在本地提交文件,然后fetch
+rebase
到origin/master
(或任何远程分支)。您将再次遇到冲突,它与第一个选项几乎相同。
回答by 53iScott
I've faced the same problem. I'm guessing you're running git in Netbeans. Please try to run the command in git shell. You'll see the difference.
我遇到了同样的问题。我猜你正在 Netbeans 中运行 git。请尝试在 git shell 中运行该命令。你会看到不同之处。
回答by Brian Knoblauch
I just recently had this same issue with not being able to merge pulls. I'm doing everything in the proper sequence, but when pulling changes after a particular user made a change it would refuse. I copied the command the Netbeans was sending and pasted it into a command line window. Despite blowing up in Netbeans it performs perfectly at doing the merge from the command line. Then I was able to push just fine.
我最近遇到了同样的问题,无法合并拉取。我正在按正确的顺序做所有事情,但是在特定用户进行更改后拉动更改时,它会拒绝。我复制了 Netbeans 发送的命令并将其粘贴到命令行窗口中。尽管在 Netbeans 中爆炸了,但它在从命令行进行合并时表现完美。然后我就可以推得很好。
回答by SolStack
In Netbeans, before doing any pull or push actions, use Git > Show Changes to see if there are any uncommitted changes. Once you have resolved these you should be able to push/pull without the error.
在 Netbeans 中,在执行任何拉取或推送操作之前,请使用 Git > Show Changes 查看是否有任何未提交的更改。一旦你解决了这些问题,你应该能够在没有错误的情况下推/拉。
See more at: https://stackoverflow.com/questions/13373330/...