Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git in netbeans - resolving conflicts

Tags:

java

git

netbeans

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.

like image 231
CodeGuy Avatar asked Oct 08 '22 15:10

CodeGuy


1 Answers

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.
like image 129
Eduardo Avatar answered Oct 10 '22 08:10

Eduardo