Skip to content

Commit d0cd928

Browse files
jvnsgitster
authored andcommitted
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]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e75b8af commit d0cd928

File tree

1 file changed

+21
-29
lines changed

1 file changed

+21
-29
lines changed

Documentation/git-rebase.adoc

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,27 @@ short-cut for `git switch topic && git rebase master`.
3939
D---E---F---G master
4040
------------
4141

42+
If there is a merge conflict during this process, `git rebase` will stop at the
43+
first problematic commit and leave conflict markers. If this happens, you can do
44+
one of these things:
45+
46+
1. Resolve the conflict. You can use `git diff` to find the markers (<<<<<<)
47+
and make edits to resolve the conflict. For each file you edit, you need to
48+
tell Git that the conflict has been resolved. You can mark the conflict as
49+
resolved with `git add <filename>`. After resolving all of the conflicts,
50+
you can continue the rebasing process with
51+
52+
git rebase --continue
53+
54+
2. Stop the `git rebase` and return your branch to its original state with
55+
56+
git rebase --abort
57+
58+
3. Skip the commit that caused the merge conflict with
59+
60+
git rebase --skip
61+
62+
4263
If `<branch>` is specified, `git rebase` will perform an automatic
4364
`git switch <branch>` before doing anything else. Otherwise
4465
it remains on the current branch.
@@ -74,13 +95,6 @@ any commits in `HEAD` which introduce the same textual changes as a commit
7495
in `HEAD..<upstream>` are omitted (i.e., a patch already accepted upstream
7596
with a different commit message or timestamp will be skipped).
7697

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

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

0 commit comments

Comments
 (0)