Git in netbeans - resolving conflicts

2019-06-27 04:08发布

I am using Git in netbeans and I wanted to commit my changes, however first I did a pull, and now there are conflicts.

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.

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?

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.

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.

1条回答
Rolldiameter
2楼-- · 2019-06-27 04:43

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.
查看更多
登录 后发表回答