Multi-person collaborative development, in the case of push updates to the server will inevitably conflict, so push before you need to resolve the server side of the latest version and the local warehouse conflict. Pull operation is to the server-side updates to the local warehouse to merge, resolve the merge conflict, you can successfully push to the server branch.
Assuming now that the Mairo brothers are working with git to develop the Newsupermairobro game, the server-side Mushroom.java file currently reads as follows:
Mairobro cloned the code, Mairo brother did the following modifications
Mairo's brother did the following modifications
Then Mairo brother first push code, Mairo brother. Use pull to merge local warehouses and remote warehouses, and the release file conflicts, when git automatically merges conflicting files, as shown in the following illustration:
Obviously automatically merged conflict files cannot be used directly, we can manually adjust, right button conflict files, select team-> merge Tool
The first is to compare the files that git automatically merged with the server-side files
The second is to use the local latest version of the file and server-side files for comparison, recommended this
The next step is the familiar contrast interface.
Mairo Brother changed the conflict file as follows
Then right click on this conflict file, select Team-> Add to index again to add the file to the index control, the file is not a conflict state, and can be committed and pushed to the server side
After resolving the merge conflict, Mairo brother only needs to pull the merged version of the server to the local, completing a collaborative development of the code merge. As you can see from the history, the history of mushroom begins with the branch, first the Mushrooma record, then the Mushroomb record, and the last History branch merges.