| 24 | Handling Conflicts |
You can’t develop a project with other developers without generating conflicting versions of code from time to time. Git goes a long way toward helping you resolve those automatically, but sometimes it can’t.
For example, the code shown on the opposite page shows two
different solutions to the same problem. You must tell Git how to
fix the conflict because it doesn’t know which version is correct.
They both make changes to the exact same lines of code. You can
find out which file or files have conflicts in two ways: the output
from the failed git merge, or
git status.
You can find conflicts within a file by looking for
<<<<<<<—seven
lesser than signs—with a commit such as
HEAD. The original code—the code inside ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access