Reputation: 953
I am very new to git / GitHub, and frequently get confused. What I am specifically confused about is how to combine two repositories with merge conflicts.
So, there is a base repository by a colleague that I forked, say his name is Frank, so I forked frank/master
into me/master
. Now I made changes, and Frank made changes, so that now me/master
is 10 commits ahead and 20 commits behind frank/master
.
Now, I want to merge the repositories back together. However, me and Frank both edited the same files, which means that a pull request can't be automatically merged.
I thought the easiest way to resolve this would be to make a new branch on GitHub (which I did), called devel
, and to pull frank/master
. I opened a pull request on GitHub, and then followed the command line instructions to resolve the conflicts:
git checkout -b frank-master devel
git pull https://github.com/frank/theRepositor.git master
Then I used git mergetool
to resolve the conflicts in meld (and edited the middle document), and then did
git checkout devel
git merge --no-ff frank-master
git push origin devel
Now the Github page says that my devel repository is 20 commits behind and 11 commits ahead of frank/master, but the pull request is still open and can't be resolved.
What did I do wrong and what is the correct workflow to resolve such conflicts and merge repositories back together?
Upvotes: 0
Views: 740
Reputation: 1101
You can resolve simple merge conflicts, like the one you are describing, in the GitHub web UI. Check out this article: https://help.github.com/articles/resolving-a-merge-conflict-on-github/
If a merge conflict has occurred because there’s a difference on the same line of the same file between the two branches of your pull request, you can now hit the Resolve conflicts button, found in in the body of the pull request. This will launch a text editor where you can resolve the issue. All other types of merge conflicts must be resolved locally on the command line.
When resolving a merge conflict, you can choose to keep the content from one of your branches or make a brand new change. Simply find and remove conflict markers (<<<<<
, =====
, >>>>>
), make your changes, hit the Mark as resolved button, and then the Commit changes button. When you have resolved all merge conflicts, the Merge pull request button will turn green, meaning you can merge your changes. This assumes any required status checks pass and that you have permission to merge to that branch.
To learn more, visit the GitHub Help article on merge conflicts: https://help.github.com/articles/about-merge-conflicts/
Upvotes: 1