Skip to content

How to Fix Merge Conflicts in GitHub? #169237

Answered by sirajahmedx
levi-codex asked this question in General
Discussion options

You must be logged in to vote

Hello!

When working with others on GitHub, sometimes two people change the same part of a file and Git doesn’t know which version to keep this is called a merge conflict.

To fix it, first pull the latest changes from the branch so you have everyone’s updates. Then open the files Git says have conflicts. You’ll see special markers like <<<<<<<, =======, and >>>>>>> showing the different versions.

Choose which parts you want to keep (or combine them), delete the markers, and make sure the file looks correct. Test your code to be sure it still works, then save the file, run git add ., commit with a short message about fixing the conflict, and push your changes back to GitHub.

Talking with yo…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@levi-codex
Comment options

Comment options

You must be logged in to vote
1 reply
@levi-codex
Comment options

Answer selected by levi-codex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
General General topics and discussions that don't fit into other categories, but are related to GitHub Question Ask and answer questions about GitHub features and usage
3 participants