Reputation: 415
Is it possible to resolve and merge a git conflict in GitHub's web interface?
Upvotes: 6
Views: 7651
Reputation: 144
This method is for those who don't want to use GitHub's web interface for conflict in multiple files. It works with every repo storage provider.
1. Suppose we have to merge branch DEV -> to -> STAGE.
2. First don't push any changes to the DEV branch and save it locally.
If the commit has been pushed to the DEV branch, you can revert those changes as they were before, by simply pushing new commit with old changes to DEV branch.
3. Create a new pull request and merge STAGE -> to -> DEV branch.
If you encounter conflicts in this step, you have made some mistake in the above step 2.
4. After the merge (STAGE -> DEV) process is complete, commit your changes to the DEV branch that were saved locally.
5. Now create a new pull request DEV -> to -> STAGE and your conflicts will be gone.
Upvotes: 1
Reputation: 26742
As of December 2016, simple merge conflicts can be resolved in GitHub's web interface.
- Under your repository name, click Pull requests.
- In the "Pull Requests" list, click the pull request with a merge conflict that you'd like to resolve.
Near the bottom of your pull request, click Resolve conflicts.
- (Tip: If the Resolve conflicts button is deactivated, your pull request's merge conflict is too complex to resolve on GitHub and you must resolve the merge conflict on the command line.)
- Decide if you want to keep only your branch's changes, keep only the other branch's changes, or make a brand new change, which may incorporate changes from both branches. Delete the conflict markers
<<<<<<<
,=======
,>>>>>>>
and make the changes you want in the final merge.
- If you have more than one merge conflict in your file, scroll down to the next set of conflict markers and repeat steps four and five to resolve your merge conflict.
- Once you've resolved all the conflicts in the file, click Mark as resolved.
- If you have more than one file with a conflict, select the next file you want to edit on the left side of the page under "conflicting files" and repeat steps four through seven until you've resolved all of your pull request's merge conflicts.
- Once you've resolved all your merge conflicts, click Commit changes.
- To merge your pull request, click Merge pull request. For more information about other pull request merge options, see "Merging a pull request."
Upvotes: 5
Reputation: 1101
Update: the ability to resolve simple merge conflicts in GitHub was released last month (Dec 2016).
If a merge conflict has occurred because there’s a difference on the same line of the same file between the two different branches of your pull request, you can now hit the Resolve conflicts button in the body of the pull request to edit the text. All other types of merge conflicts must be resolved locally on the command line.
GitHub Documentation: https://help.github.com/articles/resolving-a-merge-conflict-on-github/
Upvotes: 3
Reputation: 7100
When you are resolving conflicts on the command line normally, you are using a bash shell on Mac or something like Git Bash on Windows. In your web browser, you have a JavaScript command line, which can't emulate your bash shell.
Pretty much, you can't solve conflicts in the online JS shell.
Upvotes: 0
Reputation: 1369
The Github website does not provide an interface to deal with merge conflicts I'm afraid. You will need to pull the branches to a local machine with git and resolve the conflict from there.
Upvotes: 1