Information Technology Reference
In-Depth Information
CHAPTER 9
Resolving Conflicts
Until now, we mainly have focused on the structure of the graph of revisions. We usu-
ally committed using the $ git simple-commit alias; thus, the files we produced
were very simple. In fact, almost every file we have created so far contained only one
word. Once created, the files were rarely if ever modified. Moreover, the recipes were
composed in such a way that we usually used different filenames in different branches.
This simplified procedure of committing is a very efficient way of learning the diverse
operations on the graph of revision, such as merging and rebasing, for example.
However, they do not fully prepare you for working on a team where your colleagues
are making changes to the same file. In this chapter we will fill the gap. You will learn
how to control the contents of your file up to the point of resolving.
Working with real projects you will sooner or later encounter conflicts . They occur
when you merge branches that include different modifications of exactly the same line
of a file . If in some file, for example readme.txt , one developer types the first line
as:
Lorem ipsum
and the other developer types:
Dolor sit amet
git will not be able to automatically merge both versions. You will have to manually
choose between Lorem ipsum and Dolor sit amet . Because conflicts generally
cause much concern and consternation—they are regarded as something to be afraid
of—four recipes will explain accurately how to deal with conflicts during merge and re-
base for both text and binary files. Once you are acquainted with conflicts, take a good
Search WWH ::




Custom Search