Skip to main content

🧩 Resolving Complex Git Merge Conflicts Locally

⚠️ Problem

When merging a pull request on GitHub, you may encounter:
β€œThese conflicts are too complex to resolve in the web editor.”
This usually means:
  • Large structural differences in files
  • Binary file conflicts
  • Changes scattered across a file
  • Multiple developers editing the same areas

πŸ› οΈ Solution: Use Git Locally to Resolve

βœ… Step 1: Clone the Repository (if not done already)


πŸ” Step 2: Checkout the Base Branch (e.g., main)


πŸ”€ Step 3: Merge the Source Branch (e.g., feature-branch)

If there are conflicts, Git will output which files are conflicting.

🧹 Step 4: Resolve Conflicts Manually

Open the conflicted files in your editor. You’ll see conflict markers like this:
πŸ“ Manually edit the file to keep the correct/combined version. Then save the file.

βœ… Step 5: Mark the File as Resolved

Do this for each conflicted file you resolve.

πŸ’Ύ Step 6: Commit the Merge

Git will open the default merge message. You can leave it as-is or edit it.

πŸš€ Step 7: Push the Changes to GitHub

Now the PR should be marked as merged (or you can close the PR if you’ve pushed directly to main).

🧰 Tips

  • Use git status to see unresolved files.
  • Use GUI tools like VS Code, Sourcetree, or GitKraken if you prefer visual merge tools.
  • For large repos, make a backup branch before merging: