Lecture # 13 - Resolving Merge Conflicts

Lecture # 13 - Resolving Merge Conflicts

Learn how to resolve merge conflicts.

Resolving Merge Conflicts:

Merge conflicts occur in Git when you attempt to merge branches, and Git is unable to automatically reconcile the differences between the changes made on the branches. This typically happens when both branches have modifications to the same part of a file or when changes are made to files that were deleted in one branch but modified in another. Git marks these conflicting sections in the affected files, and it's up to you to manually resolve them.

  • First Branch:

  • Second Branch:

  • Merge The Branches:

    There is a merge conflict. We need to resolve the conflict now.

  • Cancel the merging by using git merge --abort. This command will move back to where you were before merging.

  • Resolve the conflicts manually.

  • Check the git status, add the file to the staging area, and then commit the changes.