Eclipse has a git plugin called Egit, which implements local code and remote code comparisons, merges, and commits. However, when there is a conflict between the local code and the remote code, the Egit solution is a bit more complicated. Today we will thoroughly clarify these steps, and openly let some beginners like me have a guide, if there is inappropriate, please correct me.
Here I do a test project through the OSC git, I first take the project down, and then make some changes to the project in the OSC, and revise the projects that have been brought down.
Step 1
By right-clicking the project in Eclipse, select Synchronize Workspace in the Team option, and then the project synchronization view appears, for example,
It should be noted that there are two documents that are in conflict with each other. Mo-Anxious, walk up.
Step 2
Now that there is a conflict, you start merging conflicts. Before merging conflicts, commit the code to Git's local repository. Now in the Sync view right-click the project and choose Commit, for example,
It then jumps to the code submission view, for example,
Click the Commit button, and note that the Commmit button is not a commit and Push.
SETP 3
After we commit the code to the local repository, we can pull down the remote code and merge it, for example,
After pulling the remote code down, the synchronization view is as follows
Here is a bit strange, egit remote code pull down at the same time will be the code merge at the same time, this action is very reasonable, but let me very uncomfortable. But whatever it is, go ahead. Clicking on a conflicting file will see the following view in the contrasting view on the right.
All we have to do is fix the files that have been merged.
SETP 4
After correcting the merged code, it is very important to right-click the project in the Project comparison view and select Add to Index.
Then the project comparison view will look like this,
Note that at this time, the conflicting files in front of the conflicting symbols will have more stars.
SETP 5
Now that the merge is complete, you can submit the code to the remote repository. Right-click on the project to select Commit and in the view below, tap commit and Push,
By now this step, conguratulation, has been taken care of.
Original link: https://www.cnblogs.com/ultrazb/p/3843456.html
Eclipse's Egit plugin conflict Merge method