git merge of head with origin/master failed because of these files in Netbeans

23,490

Solution 1

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.

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.

Solution 2

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.

Solution 3

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.

Share:
23,490
David Sonnenfeld
Author by

David Sonnenfeld

Updated on December 19, 2020

Comments

  • David Sonnenfeld
    David Sonnenfeld over 3 years

    We are working with Netbeans and sometimes get an error when pulling/pushing from git

    git merge of head with origin/master failed because of these files: ".../Filename.java"

    What can we do? How to solve this in netbeans? We tried everything -> commit -> pull - same error -> commit -> push - same error

    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...

    But if I do the git pull via netbeans, netbeans doesnt show me anything, it keeps the file as it is without putting

    <<<<<< HEAD:file.java
    blablabla
    ========
    blabla
    >>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.java
    

    inside.

  • David Sonnenfeld
    David Sonnenfeld over 11 years
    so in other words: Add -> Commit -> Pull -> Push instead of Add -> Commit -> Push -> Pull, right?
  • mgarciaisaia
    mgarciaisaia over 11 years
    @Delta458 yeah, I think. Make sure to check any conflicts when you pull. You should resolve any.