Skip to content

Commit ad63f69

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 e7a8fbb commit ad63f69

File tree

1 file changed

+20
-29
lines changed

1 file changed

+20
-29
lines changed

Documentation/git-rebase.adoc

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,26 @@ shortcut for `git checkout topic && git rebase master`.
4242
------------
4343

4444

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

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

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

0 commit comments

Comments
 (0)