Git Merge Conflicts
Learning Goals
- Understand how to prevent and resolve merge conflicts
Merge Conflicts
Merge conflicts will happen to you at some point, and its important to learn how to resolve them successfully. A merge conflict happens when two branches change code in the same spot of a file and are attempted to be merged. Git doesn’t know which of the changes to keep, and needs our help to resolve the conflict.
Partner One
- Make sure you are on your
main
branch - DONT pull down the changes that have been merged in (NOTE: This is BAD practice, we’re only doing it to trigger a merge conflict)
- Make a change to the README
- Add, commit and push those changes to
main
(NOTE: BAD PRACTICE - DONT DO IN REAL LIFE) - Resolve merge conflict in your text editor