Skip to content

Commit f4f0a5a

Browse files
committed
doc: git rebase: dedup merge conflict discussion
Previously there were two explanations, this combines them both into a single explanation. Signed-off-by: Julia Evans <[email protected]>
1 parent ac3a91c commit f4f0a5a

File tree

1 file changed

+23
-29
lines changed

1 file changed

+23
-29
lines changed

Documentation/git-rebase.adoc

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,29 @@ from `master` and copy the changes in each of those commits on top of the
3636
D---E---F---G master
3737
------------
3838

39+
If there is a merge conflict during this process, `git rebase` will stop at the
40+
first problematic commit and leave conflict markers. If this happens, you can:
41+
42+
1. Resolve the conflict. You can use `git diff` to find the markers (<<<<<<)
43+
and make edits to resolve the conflict. For each file you edit, you need to
44+
tell Git that the conflict has been resolved. Typically this would be
45+
done with
46+
47+
git add <filename>
48+
49+
You can then continue the rebasing process with
50+
51+
git rebase --continue
52+
53+
2. Stop the `git rebase` and return your branch to its original state with
54+
55+
git rebase --abort
56+
57+
3. Skip the commit that caused the merge conflict with
58+
59+
git rebase --skip
60+
61+
3962
If `<branch>` is specified, `git rebase` will perform an automatic
4063
`git switch <branch>` before doing anything else. Otherwise
4164
it remains on the current branch.
@@ -71,13 +94,6 @@ any commits in `HEAD` which introduce the same textual changes as a commit
7194
in `HEAD..<upstream>` are omitted (i.e., a patch already accepted upstream
7295
with a different commit message or timestamp will be skipped).
7396

74-
It is possible that a merge failure will prevent this process from being
75-
completely automatic. You will have to resolve any such merge failure
76-
and run `git rebase --continue`. Another option is to bypass the commit
77-
that caused the merge failure with `git rebase --skip`. To check out the
78-
original `<branch>` and remove the `.git/rebase-apply` working files, use
79-
the command `git rebase --abort` instead.
80-
8197
If the upstream branch already contains a change you have made (e.g.,
8298
because you mailed a patch which was applied upstream), then that commit
8399
will be skipped and warnings will be issued (if the 'merge' backend is
@@ -180,28 +196,6 @@ This is useful if F and G were flawed in some way, or should not be
180196
part of topicA. Note that the argument to `--onto` and the `<upstream>`
181197
parameter can be any valid commit-ish.
182198

183-
In case of conflict, `git rebase` will stop at the first problematic commit
184-
and leave conflict markers in the tree. You can use `git diff` to locate
185-
the markers (<<<<<<) and make edits to resolve the conflict. For each
186-
file you edit, you need to tell Git that the conflict has been resolved,
187-
typically this would be done with
188-
189-
190-
git add <filename>
191-
192-
193-
After resolving the conflict manually and updating the index with the
194-
desired resolution, you can continue the rebasing process with
195-
196-
197-
git rebase --continue
198-
199-
200-
Alternatively, you can undo the 'git rebase' with
201-
202-
203-
git rebase --abort
204-
205199
MODE OPTIONS
206200
------------
207201

0 commit comments

Comments
 (0)