@@ -26,7 +26,7 @@ Git branches
2626 switches between branches.
2727
2828 ``-c ``
29- creates a new branch.
29+ creates the branch to switch to .
3030
3131 .. note ::
3232
@@ -40,7 +40,7 @@ Git branches
4040 creates the specified branch if it does not already exist.
4141
4242:samp: `$ git merge { FROM_BRANCH_NAME } `
43- connects the given branch with the current branch you are currently in, for
43+ connects the specified branch with the branch you are currently in, for
4444 example:
4545
4646 .. code-block :: console
@@ -77,12 +77,12 @@ Merge conflicts
7777
7878Occasionally, however, Git runs into issues with merging, such as:
7979
80- .. code-block :: console
80+ .. code-block :: console
8181
82- $ git merge 'my-feature'
83- Auto-merging setup.py
84- CONFLICT (content): Merge conflict in setup.py
85- Automatic merge failed; fix conflicts and then commit the result.
82+ $ git merge 'my-feature'
83+ Auto-merging setup.py
84+ CONFLICT (content): Merge conflict in setup.py
85+ Automatic merge failed; fix conflicts and then commit the result.
8686
8787 The history can then look like this, for example:
8888
@@ -102,6 +102,62 @@ The history can then look like this, for example:
102102 * `Git Tools - Advanced Merging
103103 <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging> `_
104104
105+ Improved conflict display with zdiff3
106+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107+
108+ Git normally displays merge conflicts as follows:
109+
110+ .. code-block :: console
111+
112+ <<<<<<< HEAD
113+ This line has been changed by feature one.
114+ This line has also been changed by feature one.
115+ This line will be changed by feature two.
116+ =======
117+ This line is changed by feature one.
118+ This line has been changed by feature two.
119+ This line has also been changed by feature two.
120+ >>>>>>> feature_two
121+
122+ The lines of the merge target are located between the markers ``<<<<<<< `` and
123+ ``======= ``. The lines between the markers ``======= `` and ``>>>>>>> `` are the
124+ lines of the merge source. The labels after the arrow markers name the commit
125+ references that are merged.
126+
127+ This is often sufficient to resolve a conflict. But it can also be unnecessarily
128+ challenging because the original lines from which both sides started are
129+ missing. The common ground from which both sides started creates clarity about
130+ the context in which both changes arose.
131+
132+ If you set `merge.conflictStyle
133+ <https://git-scm.com/docs/git-config#Documentation/git-config.txt-mergeconflictStyle> `_
134+ to ``zdiff3 ``, you can also display the common basis:
135+
136+ .. code-block :: console
137+
138+ $ git config --global merge.conflictStyle zdiff3
139+
140+ Here is the same merge with this style:
141+
142+ .. code-block :: console
143+
144+ <<<<<<< HEAD
145+ This line has been changed by feature one.
146+ This line has also been changed by feature one.
147+ This line will be changed by feature two.
148+ ||||||| 45d92bd
149+ This line is changed by feature one.
150+ This line will be changed by feature one and feature two.
151+ This line will be changed by feature two.
152+ =======
153+ This line is changed by feature one.
154+ This line has been changed by feature two.
155+ This line has also been changed by feature two.
156+
157+ The common base is now displayed between the markers ``||||||| `` and
158+ ``======= `` with the SHA value of the common base. This additional context is
159+ often useful for resolving a conflict.
160+
105161``rerere `` to reuse recorded conflict resolutions
106162~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107163
0 commit comments