Combine Git Conflict

Me and my fork friend from the main repository (upstream). Last night we had the same version of this repository on the local machine. Then I added a new function, and my friend also added another new function. My friend pulled the request into the main repository, and I combined this upload request with an upstream repository without conflicts. And when I exit the upstream and merge with my master branch, it conflicts. What should I do in this situation to resolve the conflict? (There should be 2 new functions in the upstream repository after resolving the conflict)

+6
source share
3 answers

Just browse the files marked as conflicting git status and look for conflict markers (you can search ==== in the file). Copy the changes between them, find out if something unexpected is unexpectedly broken by a combination of your code, run your tests, and then use git add and git commit , as usual, to merge your new new function with yours.

 Upstream: original with friend feature with both \ \ / \ / \ -- Friend --/ \ / \ \ / ---- Yours ------------------------- your merge 
+4
source

Please note that you can also directly resolve the merge conflict with Eclipse / Egit itself:
See " Egit: Resolving Merge Conflicts ":

You can manually edit the text on the left side or use the Copy current change button from right to left to copy conflicting changes from right to left.

The next step from the file’s context menu is to select the command β†’ Add to Index. Then do it.

merge conflict resolution in EGit

+10
source

You can enter git difftool path/filename in the console to use the conflict resolution tool or to use the Git software with built-in conflict resolution. I really like SmartGit (from the creators of SmartSVN) and TortoiseGit (very similar to TortoiseSVN).

+1
source

Source: https://habr.com/ru/post/914441/


All Articles