I and my friend fork from the main repository (upstream). Last night, we had the same version of this repository in local machine. Then I have added a new feature and my friend also added another new feature too. My friend pulled request to the main repository and I have merge this pull request with the upstream repository with no conflict. And when I fetch from upstream and merge with my master branch, it conflicts. What should I do in this situation to resolve conflict? (The upstream repository should have 2 new features after resolving conflict)
Note that you can also solve directly a merge conflict from Eclipse/Egit itself:
See "Egit: Solving Merge Conflicts":
You can manually edit the text on the left side or use the Copy current change from right to left button to copy the conflicting changes from right to left.
Next step is from the context menu of the file, to select Team -> Add to index. Than commit.
Just go through the files marked as conflicted by git status
and find the conflict markers (you can search for ====
in the file). Reconcile the changes between them, figure out if anything else unexpected got broken by the combination of your code, run your tests, and then use git add
and git commit
as normal to make a commit merging your friend's new feature with yours.
Upstream: original with friend's feature with both
\ \ / \ /
\ -- Friend's --/ \ /
\ \ /
---- Yours ------------------------- your merge
You can type git difftool path/filename
in the console to use a tool to resolve the conflict or use Git software that has conflict resolution built in. I really like SmartGit (from the makers of SmartSVN) and TortoiseGit (very similar to TortoiseSVN).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With