@@ -26,7 +26,7 @@ Git branches
26
26
switches between branches.
27
27
28
28
``-c ``
29
- creates a new branch.
29
+ creates the branch to switch to .
30
30
31
31
.. note ::
32
32
@@ -40,7 +40,7 @@ Git branches
40
40
creates the specified branch if it does not already exist.
41
41
42
42
: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
44
44
example:
45
45
46
46
.. code-block :: console
@@ -77,12 +77,12 @@ Merge conflicts
77
77
78
78
Occasionally, however, Git runs into issues with merging, such as:
79
79
80
- .. code-block :: console
80
+ .. code-block :: console
81
81
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.
86
86
87
87
The history can then look like this, for example:
88
88
@@ -102,6 +102,62 @@ The history can then look like this, for example:
102
102
* `Git Tools - Advanced Merging
103
103
<https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging> `_
104
104
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
+
105
161
``rerere `` to reuse recorded conflict resolutions
106
162
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107
163
0 commit comments