1GIT-REBASE(1) Git Manual GIT-REBASE(1)
2
3
4
6 git-rebase - Reapply commits on top of another base tip
7
9 git rebase [-i | --interactive] [<options>] [--exec <cmd>]
10 [--onto <newbase> | --keep-base] [<upstream> [<branch>]]
11 git rebase [-i | --interactive] [<options>] [--exec <cmd>] [--onto <newbase>]
12 --root [<branch>]
13 git rebase (--continue | --skip | --abort | --quit | --edit-todo | --show-current-patch)
14
16 If <branch> is specified, git rebase will perform an automatic git
17 switch <branch> before doing anything else. Otherwise it remains on the
18 current branch.
19
20 If <upstream> is not specified, the upstream configured in
21 branch.<name>.remote and branch.<name>.merge options will be used (see
22 git-config(1) for details) and the --fork-point option is assumed. If
23 you are currently not on any branch or if the current branch does not
24 have a configured upstream, the rebase will abort.
25
26 All changes made by commits in the current branch but that are not in
27 <upstream> are saved to a temporary area. This is the same set of
28 commits that would be shown by git log <upstream>..HEAD; or by git log
29 'fork_point'..HEAD, if --fork-point is active (see the description on
30 --fork-point below); or by git log HEAD, if the --root option is
31 specified.
32
33 The current branch is reset to <upstream>, or <newbase> if the --onto
34 option was supplied. This has the exact same effect as git reset --hard
35 <upstream> (or <newbase>). ORIG_HEAD is set to point at the tip of the
36 branch before the reset.
37
38 The commits that were previously saved into the temporary area are then
39 reapplied to the current branch, one by one, in order. Note that any
40 commits in HEAD which introduce the same textual changes as a commit in
41 HEAD..<upstream> are omitted (i.e., a patch already accepted upstream
42 with a different commit message or timestamp will be skipped).
43
44 It is possible that a merge failure will prevent this process from
45 being completely automatic. You will have to resolve any such merge
46 failure and run git rebase --continue. Another option is to bypass the
47 commit that caused the merge failure with git rebase --skip. To check
48 out the original <branch> and remove the .git/rebase-apply working
49 files, use the command git rebase --abort instead.
50
51 Assume the following history exists and the current branch is "topic":
52
53 A---B---C topic
54 /
55 D---E---F---G master
56
57 From this point, the result of either of the following commands:
58
59 git rebase master
60 git rebase master topic
61
62 would be:
63
64 A'--B'--C' topic
65 /
66 D---E---F---G master
67
68 NOTE: The latter form is just a short-hand of git checkout topic
69 followed by git rebase master. When rebase exits topic will remain the
70 checked-out branch.
71
72 If the upstream branch already contains a change you have made (e.g.,
73 because you mailed a patch which was applied upstream), then that
74 commit will be skipped. For example, running git rebase master on the
75 following history (in which A' and A introduce the same set of changes,
76 but have different committer information):
77
78 A---B---C topic
79 /
80 D---E---A'---F master
81
82 will result in:
83
84 B'---C' topic
85 /
86 D---E---A'---F master
87
88 Here is how you would transplant a topic branch based on one branch to
89 another, to pretend that you forked the topic branch from the latter
90 branch, using rebase --onto.
91
92 First let’s assume your topic is based on branch next. For example, a
93 feature developed in topic depends on some functionality which is found
94 in next.
95
96 o---o---o---o---o master
97 \
98 o---o---o---o---o next
99 \
100 o---o---o topic
101
102 We want to make topic forked from branch master; for example, because
103 the functionality on which topic depends was merged into the more
104 stable master branch. We want our tree to look like this:
105
106 o---o---o---o---o master
107 | \
108 | o'--o'--o' topic
109 \
110 o---o---o---o---o next
111
112 We can get this using the following command:
113
114 git rebase --onto master next topic
115
116 Another example of --onto option is to rebase part of a branch. If we
117 have the following situation:
118
119 H---I---J topicB
120 /
121 E---F---G topicA
122 /
123 A---B---C---D master
124
125 then the command
126
127 git rebase --onto master topicA topicB
128
129 would result in:
130
131 H'--I'--J' topicB
132 /
133 | E---F---G topicA
134 |/
135 A---B---C---D master
136
137 This is useful when topicB does not depend on topicA.
138
139 A range of commits could also be removed with rebase. If we have the
140 following situation:
141
142 E---F---G---H---I---J topicA
143
144 then the command
145
146 git rebase --onto topicA~5 topicA~3 topicA
147
148 would result in the removal of commits F and G:
149
150 E---H'---I'---J' topicA
151
152 This is useful if F and G were flawed in some way, or should not be
153 part of topicA. Note that the argument to --onto and the <upstream>
154 parameter can be any valid commit-ish.
155
156 In case of conflict, git rebase will stop at the first problematic
157 commit and leave conflict markers in the tree. You can use git diff to
158 locate the markers (<<<<<<) and make edits to resolve the conflict. For
159 each file you edit, you need to tell Git that the conflict has been
160 resolved, typically this would be done with
161
162 git add <filename>
163
164 After resolving the conflict manually and updating the index with the
165 desired resolution, you can continue the rebasing process with
166
167 git rebase --continue
168
169 Alternatively, you can undo the git rebase with
170
171 git rebase --abort
172
174 --onto <newbase>
175 Starting point at which to create the new commits. If the --onto
176 option is not specified, the starting point is <upstream>. May be
177 any valid commit, and not just an existing branch name.
178
179 As a special case, you may use "A...B" as a shortcut for the merge
180 base of A and B if there is exactly one merge base. You can leave
181 out at most one of A and B, in which case it defaults to HEAD.
182
183 --keep-base
184 Set the starting point at which to create the new commits to the
185 merge base of <upstream> <branch>. Running git rebase --keep-base
186 <upstream> <branch> is equivalent to running git rebase --onto
187 <upstream>... <upstream>.
188
189 This option is useful in the case where one is developing a feature
190 on top of an upstream branch. While the feature is being worked on,
191 the upstream branch may advance and it may not be the best idea to
192 keep rebasing on top of the upstream but to keep the base commit
193 as-is.
194
195 Although both this option and --fork-point find the merge base
196 between <upstream> and <branch>, this option uses the merge base as
197 the starting point on which new commits will be created, whereas
198 --fork-point uses the merge base to determine the set of commits
199 which will be rebased.
200
201 See also INCOMPATIBLE OPTIONS below.
202
203 <upstream>
204 Upstream branch to compare against. May be any valid commit, not
205 just an existing branch name. Defaults to the configured upstream
206 for the current branch.
207
208 <branch>
209 Working branch; defaults to HEAD.
210
211 --continue
212 Restart the rebasing process after having resolved a merge
213 conflict.
214
215 --abort
216 Abort the rebase operation and reset HEAD to the original branch.
217 If <branch> was provided when the rebase operation was started,
218 then HEAD will be reset to <branch>. Otherwise HEAD will be reset
219 to where it was when the rebase operation was started.
220
221 --quit
222 Abort the rebase operation but HEAD is not reset back to the
223 original branch. The index and working tree are also left unchanged
224 as a result. If a temporary stash entry was created using
225 --autostash, it will be saved to the stash list.
226
227 --apply
228 Use applying strategies to rebase (calling git-am internally). This
229 option may become a no-op in the future once the merge backend
230 handles everything the apply one does.
231
232 See also INCOMPATIBLE OPTIONS below.
233
234 --empty={drop,keep,ask}
235 How to handle commits that are not empty to start and are not clean
236 cherry-picks of any upstream commit, but which become empty after
237 rebasing (because they contain a subset of already upstream
238 changes). With drop (the default), commits that become empty are
239 dropped. With keep, such commits are kept. With ask (implied by
240 --interactive), the rebase will halt when an empty commit is
241 applied allowing you to choose whether to drop it, edit files more,
242 or just commit the empty changes. Other options, like --exec, will
243 use the default of drop unless -i/--interactive is explicitly
244 specified.
245
246 Note that commits which start empty are kept (unless
247 --no-keep-empty is specified), and commits which are clean
248 cherry-picks (as determined by git log --cherry-mark ...) are
249 detected and dropped as a preliminary step (unless
250 --reapply-cherry-picks is passed).
251
252 See also INCOMPATIBLE OPTIONS below.
253
254 --no-keep-empty, --keep-empty
255 Do not keep commits that start empty before the rebase (i.e. that
256 do not change anything from its parent) in the result. The default
257 is to keep commits which start empty, since creating such commits
258 requires passing the --allow-empty override flag to git commit,
259 signifying that a user is very intentionally creating such a commit
260 and thus wants to keep it.
261
262 Usage of this flag will probably be rare, since you can get rid of
263 commits that start empty by just firing up an interactive rebase
264 and removing the lines corresponding to the commits you don’t want.
265 This flag exists as a convenient shortcut, such as for cases where
266 external tools generate many empty commits and you want them all
267 removed.
268
269 For commits which do not start empty but become empty after
270 rebasing, see the --empty flag.
271
272 See also INCOMPATIBLE OPTIONS below.
273
274 --reapply-cherry-picks, --no-reapply-cherry-picks
275 Reapply all clean cherry-picks of any upstream commit instead of
276 preemptively dropping them. (If these commits then become empty
277 after rebasing, because they contain a subset of already upstream
278 changes, the behavior towards them is controlled by the --empty
279 flag.)
280
281 By default (or if --no-reapply-cherry-picks is given), these
282 commits will be automatically dropped. Because this necessitates
283 reading all upstream commits, this can be expensive in repos with a
284 large number of upstream commits that need to be read.
285
286 --reapply-cherry-picks allows rebase to forgo reading all upstream
287 commits, potentially improving performance.
288
289 See also INCOMPATIBLE OPTIONS below.
290
291 --allow-empty-message
292 No-op. Rebasing commits with an empty message used to fail and this
293 option would override that behavior, allowing commits with empty
294 messages to be rebased. Now commits with an empty message do not
295 cause rebasing to halt.
296
297 See also INCOMPATIBLE OPTIONS below.
298
299 --skip
300 Restart the rebasing process by skipping the current patch.
301
302 --edit-todo
303 Edit the todo list during an interactive rebase.
304
305 --show-current-patch
306 Show the current patch in an interactive rebase or when rebase is
307 stopped because of conflicts. This is the equivalent of git show
308 REBASE_HEAD.
309
310 -m, --merge
311 Using merging strategies to rebase (default).
312
313 Note that a rebase merge works by replaying each commit from the
314 working branch on top of the <upstream> branch. Because of this,
315 when a merge conflict happens, the side reported as ours is the
316 so-far rebased series, starting with <upstream>, and theirs is the
317 working branch. In other words, the sides are swapped.
318
319 See also INCOMPATIBLE OPTIONS below.
320
321 -s <strategy>, --strategy=<strategy>
322 Use the given merge strategy, instead of the default recursive.
323 This implies --merge.
324
325 Because git rebase replays each commit from the working branch on
326 top of the <upstream> branch using the given strategy, using the
327 ours strategy simply empties all patches from the <branch>, which
328 makes little sense.
329
330 See also INCOMPATIBLE OPTIONS below.
331
332 -X <strategy-option>, --strategy-option=<strategy-option>
333 Pass the <strategy-option> through to the merge strategy. This
334 implies --merge and, if no strategy has been specified, -s
335 recursive. Note the reversal of ours and theirs as noted above for
336 the -m option.
337
338 See also INCOMPATIBLE OPTIONS below.
339
340 --rerere-autoupdate, --no-rerere-autoupdate
341 Allow the rerere mechanism to update the index with the result of
342 auto-conflict resolution if possible.
343
344 -S[<keyid>], --gpg-sign[=<keyid>], --no-gpg-sign
345 GPG-sign commits. The keyid argument is optional and defaults to
346 the committer identity; if specified, it must be stuck to the
347 option without a space. --no-gpg-sign is useful to countermand
348 both commit.gpgSign configuration variable, and earlier --gpg-sign.
349
350 -q, --quiet
351 Be quiet. Implies --no-stat.
352
353 -v, --verbose
354 Be verbose. Implies --stat.
355
356 --stat
357 Show a diffstat of what changed upstream since the last rebase. The
358 diffstat is also controlled by the configuration option
359 rebase.stat.
360
361 -n, --no-stat
362 Do not show a diffstat as part of the rebase process.
363
364 --no-verify
365 This option bypasses the pre-rebase hook. See also githooks(5).
366
367 --verify
368 Allows the pre-rebase hook to run, which is the default. This
369 option can be used to override --no-verify. See also githooks(5).
370
371 -C<n>
372 Ensure at least <n> lines of surrounding context match before and
373 after each change. When fewer lines of surrounding context exist
374 they all must match. By default no context is ever ignored. Implies
375 --apply.
376
377 See also INCOMPATIBLE OPTIONS below.
378
379 --no-ff, --force-rebase, -f
380 Individually replay all rebased commits instead of fast-forwarding
381 over the unchanged ones. This ensures that the entire history of
382 the rebased branch is composed of new commits.
383
384 You may find this helpful after reverting a topic branch merge, as
385 this option recreates the topic branch with fresh commits so it can
386 be remerged successfully without needing to "revert the reversion"
387 (see the revert-a-faulty-merge How-To[1] for details).
388
389 --fork-point, --no-fork-point
390 Use reflog to find a better common ancestor between <upstream> and
391 <branch> when calculating which commits have been introduced by
392 <branch>.
393
394 When --fork-point is active, fork_point will be used instead of
395 <upstream> to calculate the set of commits to rebase, where
396 fork_point is the result of git merge-base --fork-point <upstream>
397 <branch> command (see git-merge-base(1)). If fork_point ends up
398 being empty, the <upstream> will be used as a fallback.
399
400 If <upstream> is given on the command line, then the default is
401 --no-fork-point, otherwise the default is --fork-point.
402
403 If your branch was based on <upstream> but <upstream> was rewound
404 and your branch contains commits which were dropped, this option
405 can be used with --keep-base in order to drop those commits from
406 your branch.
407
408 See also INCOMPATIBLE OPTIONS below.
409
410 --ignore-whitespace
411 Ignore whitespace differences when trying to reconcile differences.
412 Currently, each backend implements an approximation of this
413 behavior:
414
415 apply backend: When applying a patch, ignore changes in whitespace
416 in context lines. Unfortunately, this means that if the "old" lines
417 being replaced by the patch differ only in whitespace from the
418 existing file, you will get a merge conflict instead of a
419 successful patch application.
420
421 merge backend: Treat lines with only whitespace changes as
422 unchanged when merging. Unfortunately, this means that any patch
423 hunks that were intended to modify whitespace and nothing else will
424 be dropped, even if the other side had no changes that conflicted.
425
426 --whitespace=<option>
427 This flag is passed to the git apply program (see git-apply(1))
428 that applies the patch. Implies --apply.
429
430 See also INCOMPATIBLE OPTIONS below.
431
432 --committer-date-is-author-date
433 Instead of using the current time as the committer date, use the
434 author date of the commit being rebased as the committer date. This
435 option implies --force-rebase.
436
437 --ignore-date, --reset-author-date
438 Instead of using the author date of the original commit, use the
439 current time as the author date of the rebased commit. This option
440 implies --force-rebase.
441
442 See also INCOMPATIBLE OPTIONS below.
443
444 --signoff
445 Add a Signed-off-by trailer to all the rebased commits. Note that
446 if --interactive is given then only commits marked to be picked,
447 edited or reworded will have the trailer added.
448
449 See also INCOMPATIBLE OPTIONS below.
450
451 -i, --interactive
452 Make a list of the commits which are about to be rebased. Let the
453 user edit that list before rebasing. This mode can also be used to
454 split commits (see SPLITTING COMMITS below).
455
456 The commit list format can be changed by setting the configuration
457 option rebase.instructionFormat. A customized instruction format
458 will automatically have the long commit hash prepended to the
459 format.
460
461 See also INCOMPATIBLE OPTIONS below.
462
463 -r, --rebase-merges[=(rebase-cousins|no-rebase-cousins)]
464 By default, a rebase will simply drop merge commits from the todo
465 list, and put the rebased commits into a single, linear branch.
466 With --rebase-merges, the rebase will instead try to preserve the
467 branching structure within the commits that are to be rebased, by
468 recreating the merge commits. Any resolved merge conflicts or
469 manual amendments in these merge commits will have to be
470 resolved/re-applied manually.
471
472 By default, or when no-rebase-cousins was specified, commits which
473 do not have <upstream> as direct ancestor will keep their original
474 branch point, i.e. commits that would be excluded by git-log(1)'s
475 --ancestry-path option will keep their original ancestry by
476 default. If the rebase-cousins mode is turned on, such commits are
477 instead rebased onto <upstream> (or <onto>, if specified).
478
479 The --rebase-merges mode is similar in spirit to the deprecated
480 --preserve-merges but works with interactive rebases, where commits
481 can be reordered, inserted and dropped at will.
482
483 It is currently only possible to recreate the merge commits using
484 the recursive merge strategy; different merge strategies can be
485 used only via explicit exec git merge -s <strategy> [...]
486 commands.
487
488 See also REBASING MERGES and INCOMPATIBLE OPTIONS below.
489
490 -p, --preserve-merges
491 [DEPRECATED: use --rebase-merges instead] Recreate merge commits
492 instead of flattening the history by replaying commits a merge
493 commit introduces. Merge conflict resolutions or manual amendments
494 to merge commits are not preserved.
495
496 This uses the --interactive machinery internally, but combining it
497 with the --interactive option explicitly is generally not a good
498 idea unless you know what you are doing (see BUGS below).
499
500 See also INCOMPATIBLE OPTIONS below.
501
502 -x <cmd>, --exec <cmd>
503 Append "exec <cmd>" after each line creating a commit in the final
504 history. <cmd> will be interpreted as one or more shell commands.
505 Any command that fails will interrupt the rebase, with exit code 1.
506
507 You may execute several commands by either using one instance of
508 --exec with several commands:
509
510 git rebase -i --exec "cmd1 && cmd2 && ..."
511
512 or by giving more than one --exec:
513
514 git rebase -i --exec "cmd1" --exec "cmd2" --exec ...
515
516 If --autosquash is used, "exec" lines will not be appended for the
517 intermediate commits, and will only appear at the end of each
518 squash/fixup series.
519
520 This uses the --interactive machinery internally, but it can be run
521 without an explicit --interactive.
522
523 See also INCOMPATIBLE OPTIONS below.
524
525 --root
526 Rebase all commits reachable from <branch>, instead of limiting
527 them with an <upstream>. This allows you to rebase the root
528 commit(s) on a branch. When used with --onto, it will skip changes
529 already contained in <newbase> (instead of <upstream>) whereas
530 without --onto it will operate on every change. When used together
531 with both --onto and --preserve-merges, all root commits will be
532 rewritten to have <newbase> as parent instead.
533
534 See also INCOMPATIBLE OPTIONS below.
535
536 --autosquash, --no-autosquash
537 When the commit log message begins with "squash! ..." or "fixup!
538 ..." or "amend! ...", and there is already a commit in the todo
539 list that matches the same ..., automatically modify the todo list
540 of rebase -i, so that the commit marked for squashing comes right
541 after the commit to be modified, and change the action of the moved
542 commit from pick to squash or fixup or fixup -C respectively. A
543 commit matches the ... if the commit subject matches, or if the
544 ... refers to the commit’s hash. As a fall-back, partial matches
545 of the commit subject work, too. The recommended way to create
546 fixup/amend/squash commits is by using the --fixup, --fixup=amend:
547 or --fixup=reword: and --squash options respectively of git-
548 commit(1).
549
550 If the --autosquash option is enabled by default using the
551 configuration variable rebase.autoSquash, this option can be used
552 to override and disable this setting.
553
554 See also INCOMPATIBLE OPTIONS below.
555
556 --autostash, --no-autostash
557 Automatically create a temporary stash entry before the operation
558 begins, and apply it after the operation ends. This means that you
559 can run rebase on a dirty worktree. However, use with care: the
560 final stash application after a successful rebase might result in
561 non-trivial conflicts.
562
563 --reschedule-failed-exec, --no-reschedule-failed-exec
564 Automatically reschedule exec commands that failed. This only makes
565 sense in interactive mode (or when an --exec option was provided).
566
567 Even though this option applies once a rebase is started, it’s set
568 for the whole rebase at the start based on either the
569 rebase.rescheduleFailedExec configuration (see git-config(1) or
570 "CONFIGURATION" below) or whether this option is provided.
571 Otherwise an explicit --no-reschedule-failed-exec at the start
572 would be overridden by the presence of
573 rebase.rescheduleFailedExec=true configuration.
574
576 The following options:
577
578 • --apply
579
580 • --whitespace
581
582 • -C
583
584 are incompatible with the following options:
585
586 • --merge
587
588 • --strategy
589
590 • --strategy-option
591
592 • --allow-empty-message
593
594 • --[no-]autosquash
595
596 • --rebase-merges
597
598 • --preserve-merges
599
600 • --interactive
601
602 • --exec
603
604 • --no-keep-empty
605
606 • --empty=
607
608 • --reapply-cherry-picks
609
610 • --edit-todo
611
612 • --root when used in combination with --onto
613
614 In addition, the following pairs of options are incompatible:
615
616 • --preserve-merges and --interactive
617
618 • --preserve-merges and --signoff
619
620 • --preserve-merges and --rebase-merges
621
622 • --preserve-merges and --empty=
623
624 • --preserve-merges and --ignore-whitespace
625
626 • --preserve-merges and --committer-date-is-author-date
627
628 • --preserve-merges and --ignore-date
629
630 • --keep-base and --onto
631
632 • --keep-base and --root
633
634 • --fork-point and --root
635
637 git rebase has two primary backends: apply and merge. (The apply
638 backend used to be known as the am backend, but the name led to
639 confusion as it looks like a verb instead of a noun. Also, the merge
640 backend used to be known as the interactive backend, but it is now used
641 for non-interactive cases as well. Both were renamed based on
642 lower-level functionality that underpinned each.) There are some subtle
643 differences in how these two backends behave:
644
645 Empty commits
646 The apply backend unfortunately drops intentionally empty commits, i.e.
647 commits that started empty, though these are rare in practice. It also
648 drops commits that become empty and has no option for controlling this
649 behavior.
650
651 The merge backend keeps intentionally empty commits by default (though
652 with -i they are marked as empty in the todo list editor, or they can
653 be dropped automatically with --no-keep-empty).
654
655 Similar to the apply backend, by default the merge backend drops
656 commits that become empty unless -i/--interactive is specified (in
657 which case it stops and asks the user what to do). The merge backend
658 also has an --empty={drop,keep,ask} option for changing the behavior of
659 handling commits that become empty.
660
661 Directory rename detection
662 Due to the lack of accurate tree information (arising from constructing
663 fake ancestors with the limited information available in patches),
664 directory rename detection is disabled in the apply backend. Disabled
665 directory rename detection means that if one side of history renames a
666 directory and the other adds new files to the old directory, then the
667 new files will be left behind in the old directory without any warning
668 at the time of rebasing that you may want to move these files into the
669 new directory.
670
671 Directory rename detection works with the merge backend to provide you
672 warnings in such cases.
673
674 Context
675 The apply backend works by creating a sequence of patches (by calling
676 format-patch internally), and then applying the patches in sequence
677 (calling am internally). Patches are composed of multiple hunks, each
678 with line numbers, a context region, and the actual changes. The line
679 numbers have to be taken with some fuzz, since the other side will
680 likely have inserted or deleted lines earlier in the file. The context
681 region is meant to help find how to adjust the line numbers in order to
682 apply the changes to the right lines. However, if multiple areas of the
683 code have the same surrounding lines of context, the wrong one can be
684 picked. There are real-world cases where this has caused commits to be
685 reapplied incorrectly with no conflicts reported. Setting diff.context
686 to a larger value may prevent such types of problems, but increases the
687 chance of spurious conflicts (since it will require more lines of
688 matching context to apply).
689
690 The merge backend works with a full copy of each relevant file,
691 insulating it from these types of problems.
692
693 Labelling of conflicts markers
694 When there are content conflicts, the merge machinery tries to annotate
695 each side’s conflict markers with the commits where the content came
696 from. Since the apply backend drops the original information about the
697 rebased commits and their parents (and instead generates new fake
698 commits based off limited information in the generated patches), those
699 commits cannot be identified; instead it has to fall back to a commit
700 summary. Also, when merge.conflictStyle is set to diff3, the apply
701 backend will use "constructed merge base" to label the content from the
702 merge base, and thus provide no information about the merge base commit
703 whatsoever.
704
705 The merge backend works with the full commits on both sides of history
706 and thus has no such limitations.
707
708 Hooks
709 The apply backend has not traditionally called the post-commit hook,
710 while the merge backend has. Both have called the post-checkout hook,
711 though the merge backend has squelched its output. Further, both
712 backends only call the post-checkout hook with the starting point
713 commit of the rebase, not the intermediate commits nor the final
714 commit. In each case, the calling of these hooks was by accident of
715 implementation rather than by design (both backends were originally
716 implemented as shell scripts and happened to invoke other commands like
717 git checkout or git commit that would call the hooks). Both backends
718 should have the same behavior, though it is not entirely clear which,
719 if any, is correct. We will likely make rebase stop calling either of
720 these hooks in the future.
721
722 Interruptability
723 The apply backend has safety problems with an ill-timed interrupt; if
724 the user presses Ctrl-C at the wrong time to try to abort the rebase,
725 the rebase can enter a state where it cannot be aborted with a
726 subsequent git rebase --abort. The merge backend does not appear to
727 suffer from the same shortcoming. (See
728 https://lore.kernel.org/git/20200207132152.GC2868@szeder.dev/ for
729 details.)
730
731 Commit Rewording
732 When a conflict occurs while rebasing, rebase stops and asks the user
733 to resolve. Since the user may need to make notable changes while
734 resolving conflicts, after conflicts are resolved and the user has run
735 git rebase --continue, the rebase should open an editor and ask the
736 user to update the commit message. The merge backend does this, while
737 the apply backend blindly applies the original commit message.
738
739 Miscellaneous differences
740 There are a few more behavioral differences that most folks would
741 probably consider inconsequential but which are mentioned for
742 completeness:
743
744 • Reflog: The two backends will use different wording when describing
745 the changes made in the reflog, though both will make use of the
746 word "rebase".
747
748 • Progress, informational, and error messages: The two backends
749 provide slightly different progress and informational messages.
750 Also, the apply backend writes error messages (such as "Your files
751 would be overwritten...") to stdout, while the merge backend writes
752 them to stderr.
753
754 • State directories: The two backends keep their state in different
755 directories under .git/
756
758 The merge mechanism (git merge and git pull commands) allows the
759 backend merge strategies to be chosen with -s option. Some strategies
760 can also take their own options, which can be passed by giving
761 -X<option> arguments to git merge and/or git pull.
762
763 recursive
764 This can only resolve two heads using a 3-way merge algorithm. When
765 there is more than one common ancestor that can be used for 3-way
766 merge, it creates a merged tree of the common ancestors and uses
767 that as the reference tree for the 3-way merge. This has been
768 reported to result in fewer merge conflicts without causing
769 mismerges by tests done on actual merge commits taken from Linux
770 2.6 kernel development history. Additionally this can detect and
771 handle merges involving renames. It does not make use of detected
772 copies. This is the default merge strategy when pulling or merging
773 one branch.
774
775 The recursive strategy can take the following options:
776
777 ours
778 This option forces conflicting hunks to be auto-resolved
779 cleanly by favoring our version. Changes from the other tree
780 that do not conflict with our side are reflected in the merge
781 result. For a binary file, the entire contents are taken from
782 our side.
783
784 This should not be confused with the ours merge strategy, which
785 does not even look at what the other tree contains at all. It
786 discards everything the other tree did, declaring our history
787 contains all that happened in it.
788
789 theirs
790 This is the opposite of ours; note that, unlike ours, there is
791 no theirs merge strategy to confuse this merge option with.
792
793 patience
794 Deprecated synonym for diff-algorithm=patience.
795
796 diff-algorithm=[patience|minimal|histogram|myers]
797 Use a different diff algorithm while merging, which can help
798 avoid mismerges that occur due to unimportant matching lines
799 (such as braces from distinct functions). See also git-diff(1)
800 --diff-algorithm. Defaults to the diff.algorithm config
801 setting.
802
803 ignore-space-change, ignore-all-space, ignore-space-at-eol,
804 ignore-cr-at-eol
805 Treats lines with the indicated type of whitespace change as
806 unchanged for the sake of a three-way merge. Whitespace changes
807 mixed with other changes to a line are not ignored. See also
808 git-diff(1) -b, -w, --ignore-space-at-eol, and
809 --ignore-cr-at-eol.
810
811 • If their version only introduces whitespace changes to a
812 line, our version is used;
813
814 • If our version introduces whitespace changes but their
815 version includes a substantial change, their version is
816 used;
817
818 • Otherwise, the merge proceeds in the usual way.
819
820 renormalize
821 This runs a virtual check-out and check-in of all three stages
822 of a file when resolving a three-way merge. This option is
823 meant to be used when merging branches with different clean
824 filters or end-of-line normalization rules. See "Merging
825 branches with differing checkin/checkout attributes" in
826 gitattributes(5) for details.
827
828 no-renormalize
829 Disables the renormalize option. This overrides the
830 merge.renormalize configuration variable.
831
832 no-renames
833 Turn off rename detection. This overrides the merge.renames
834 configuration variable. See also git-diff(1) --no-renames.
835
836 find-renames[=<n>]
837 Turn on rename detection, optionally setting the similarity
838 threshold. This is the default. This overrides the
839 merge.renames configuration variable. See also git-diff(1)
840 --find-renames.
841
842 rename-threshold=<n>
843 Deprecated synonym for find-renames=<n>.
844
845 subtree[=<path>]
846 This option is a more advanced form of subtree strategy, where
847 the strategy makes a guess on how two trees must be shifted to
848 match with each other when merging. Instead, the specified path
849 is prefixed (or stripped from the beginning) to make the shape
850 of two trees to match.
851
852 ort
853 This is meant as a drop-in replacement for the recursive algorithm
854 (as reflected in its acronym — "Ostensibly Recursive’s Twin"), and
855 will likely replace it in the future. It fixes corner cases that
856 the recursive strategy handles suboptimally, and is significantly
857 faster in large repositories — especially when many renames are
858 involved.
859
860 The ort strategy takes all the same options as recursive. However,
861 it ignores three of those options: no-renames, patience and
862 diff-algorithm. It always runs with rename detection (it handles it
863 much faster than recursive does), and it specifically uses
864 diff-algorithm=histogram.
865
866 resolve
867 This can only resolve two heads (i.e. the current branch and
868 another branch you pulled from) using a 3-way merge algorithm. It
869 tries to carefully detect criss-cross merge ambiguities. It does
870 not handle renames.
871
872 octopus
873 This resolves cases with more than two heads, but refuses to do a
874 complex merge that needs manual resolution. It is primarily meant
875 to be used for bundling topic branch heads together. This is the
876 default merge strategy when pulling or merging more than one
877 branch.
878
879 ours
880 This resolves any number of heads, but the resulting tree of the
881 merge is always that of the current branch head, effectively
882 ignoring all changes from all other branches. It is meant to be
883 used to supersede old development history of side branches. Note
884 that this is different from the -Xours option to the recursive
885 merge strategy.
886
887 subtree
888 This is a modified recursive strategy. When merging trees A and B,
889 if B corresponds to a subtree of A, B is first adjusted to match
890 the tree structure of A, instead of reading the trees at the same
891 level. This adjustment is also done to the common ancestor tree.
892
893 With the strategies that use 3-way merge (including the default,
894 recursive), if a change is made on both branches, but later reverted on
895 one of the branches, that change will be present in the merged result;
896 some people find this behavior confusing. It occurs because only the
897 heads and the merge base are considered when performing a merge, not
898 the individual commits. The merge algorithm therefore considers the
899 reverted change as no change at all, and substitutes the changed
900 version instead.
901
903 You should understand the implications of using git rebase on a
904 repository that you share. See also RECOVERING FROM UPSTREAM REBASE
905 below.
906
907 When the git-rebase command is run, it will first execute a
908 "pre-rebase" hook if one exists. You can use this hook to do sanity
909 checks and reject the rebase if it isn’t appropriate. Please see the
910 template pre-rebase hook script for an example.
911
912 Upon completion, <branch> will be the current branch.
913
915 Rebasing interactively means that you have a chance to edit the commits
916 which are rebased. You can reorder the commits, and you can remove them
917 (weeding out bad or otherwise unwanted patches).
918
919 The interactive mode is meant for this type of workflow:
920
921 1. have a wonderful idea
922
923 2. hack on the code
924
925 3. prepare a series for submission
926
927 4. submit
928
929 where point 2. consists of several instances of
930
931 a) regular use
932
933 1. finish something worthy of a commit
934
935 2. commit
936
937 b) independent fixup
938
939 1. realize that something does not work
940
941 2. fix that
942
943 3. commit it
944
945 Sometimes the thing fixed in b.2. cannot be amended to the not-quite
946 perfect commit it fixes, because that commit is buried deeply in a
947 patch series. That is exactly what interactive rebase is for: use it
948 after plenty of "a"s and "b"s, by rearranging and editing commits, and
949 squashing multiple commits into one.
950
951 Start it with the last commit you want to retain as-is:
952
953 git rebase -i <after-this-commit>
954
955 An editor will be fired up with all the commits in your current branch
956 (ignoring merge commits), which come after the given commit. You can
957 reorder the commits in this list to your heart’s content, and you can
958 remove them. The list looks more or less like this:
959
960 pick deadbee The oneline of this commit
961 pick fa1afe1 The oneline of the next commit
962 ...
963
964 The oneline descriptions are purely for your pleasure; git rebase will
965 not look at them but at the commit names ("deadbee" and "fa1afe1" in
966 this example), so do not delete or edit the names.
967
968 By replacing the command "pick" with the command "edit", you can tell
969 git rebase to stop after applying that commit, so that you can edit the
970 files and/or the commit message, amend the commit, and continue
971 rebasing.
972
973 To interrupt the rebase (just like an "edit" command would do, but
974 without cherry-picking any commit first), use the "break" command.
975
976 If you just want to edit the commit message for a commit, replace the
977 command "pick" with the command "reword".
978
979 To drop a commit, replace the command "pick" with "drop", or just
980 delete the matching line.
981
982 If you want to fold two or more commits into one, replace the command
983 "pick" for the second and subsequent commits with "squash" or "fixup".
984 If the commits had different authors, the folded commit will be
985 attributed to the author of the first commit. The suggested commit
986 message for the folded commit is the concatenation of the first
987 commit’s message with those identified by "squash" commands, omitting
988 the messages of commits identified by "fixup" commands, unless "fixup
989 -c" is used. In that case the suggested commit message is only the
990 message of the "fixup -c" commit, and an editor is opened allowing you
991 to edit the message. The contents (patch) of the "fixup -c" commit are
992 still incorporated into the folded commit. If there is more than one
993 "fixup -c" commit, the message from the final one is used. You can also
994 use "fixup -C" to get the same behavior as "fixup -c" except without
995 opening an editor.
996
997 git rebase will stop when "pick" has been replaced with "edit" or when
998 a command fails due to merge errors. When you are done editing and/or
999 resolving conflicts you can continue with git rebase --continue.
1000
1001 For example, if you want to reorder the last 5 commits, such that what
1002 was HEAD~4 becomes the new HEAD. To achieve that, you would call git
1003 rebase like this:
1004
1005 $ git rebase -i HEAD~5
1006
1007 And move the first patch to the end of the list.
1008
1009 You might want to recreate merge commits, e.g. if you have a history
1010 like this:
1011
1012 X
1013 \
1014 A---M---B
1015 /
1016 ---o---O---P---Q
1017
1018 Suppose you want to rebase the side branch starting at "A" to "Q". Make
1019 sure that the current HEAD is "B", and call
1020
1021 $ git rebase -i -r --onto Q O
1022
1023 Reordering and editing commits usually creates untested intermediate
1024 steps. You may want to check that your history editing did not break
1025 anything by running a test, or at least recompiling at intermediate
1026 points in history by using the "exec" command (shortcut "x"). You may
1027 do so by creating a todo list like this one:
1028
1029 pick deadbee Implement feature XXX
1030 fixup f1a5c00 Fix to feature XXX
1031 exec make
1032 pick c0ffeee The oneline of the next commit
1033 edit deadbab The oneline of the commit after
1034 exec cd subdir; make test
1035 ...
1036
1037 The interactive rebase will stop when a command fails (i.e. exits with
1038 non-0 status) to give you an opportunity to fix the problem. You can
1039 continue with git rebase --continue.
1040
1041 The "exec" command launches the command in a shell (the one specified
1042 in $SHELL, or the default shell if $SHELL is not set), so you can use
1043 shell features (like "cd", ">", ";" ...). The command is run from the
1044 root of the working tree.
1045
1046 $ git rebase -i --exec "make test"
1047
1048 This command lets you check that intermediate commits are compilable.
1049 The todo list becomes like that:
1050
1051 pick 5928aea one
1052 exec make test
1053 pick 04d0fda two
1054 exec make test
1055 pick ba46169 three
1056 exec make test
1057 pick f4593f9 four
1058 exec make test
1059
1061 In interactive mode, you can mark commits with the action "edit".
1062 However, this does not necessarily mean that git rebase expects the
1063 result of this edit to be exactly one commit. Indeed, you can undo the
1064 commit, or you can add other commits. This can be used to split a
1065 commit into two:
1066
1067 • Start an interactive rebase with git rebase -i <commit>^, where
1068 <commit> is the commit you want to split. In fact, any commit range
1069 will do, as long as it contains that commit.
1070
1071 • Mark the commit you want to split with the action "edit".
1072
1073 • When it comes to editing that commit, execute git reset HEAD^. The
1074 effect is that the HEAD is rewound by one, and the index follows
1075 suit. However, the working tree stays the same.
1076
1077 • Now add the changes to the index that you want to have in the first
1078 commit. You can use git add (possibly interactively) or git gui (or
1079 both) to do that.
1080
1081 • Commit the now-current index with whatever commit message is
1082 appropriate now.
1083
1084 • Repeat the last two steps until your working tree is clean.
1085
1086 • Continue the rebase with git rebase --continue.
1087
1088 If you are not absolutely sure that the intermediate revisions are
1089 consistent (they compile, pass the testsuite, etc.) you should use git
1090 stash to stash away the not-yet-committed changes after each commit,
1091 test, and amend the commit if fixes are necessary.
1092
1094 Rebasing (or any other form of rewriting) a branch that others have
1095 based work on is a bad idea: anyone downstream of it is forced to
1096 manually fix their history. This section explains how to do the fix
1097 from the downstream’s point of view. The real fix, however, would be to
1098 avoid rebasing the upstream in the first place.
1099
1100 To illustrate, suppose you are in a situation where someone develops a
1101 subsystem branch, and you are working on a topic that is dependent on
1102 this subsystem. You might end up with a history like the following:
1103
1104 o---o---o---o---o---o---o---o master
1105 \
1106 o---o---o---o---o subsystem
1107 \
1108 *---*---* topic
1109
1110 If subsystem is rebased against master, the following happens:
1111
1112 o---o---o---o---o---o---o---o master
1113 \ \
1114 o---o---o---o---o o'--o'--o'--o'--o' subsystem
1115 \
1116 *---*---* topic
1117
1118 If you now continue development as usual, and eventually merge topic to
1119 subsystem, the commits from subsystem will remain duplicated forever:
1120
1121 o---o---o---o---o---o---o---o master
1122 \ \
1123 o---o---o---o---o o'--o'--o'--o'--o'--M subsystem
1124 \ /
1125 *---*---*-..........-*--* topic
1126
1127 Such duplicates are generally frowned upon because they clutter up
1128 history, making it harder to follow. To clean things up, you need to
1129 transplant the commits on topic to the new subsystem tip, i.e., rebase
1130 topic. This becomes a ripple effect: anyone downstream from topic is
1131 forced to rebase too, and so on!
1132
1133 There are two kinds of fixes, discussed in the following subsections:
1134
1135 Easy case: The changes are literally the same.
1136 This happens if the subsystem rebase was a simple rebase and had no
1137 conflicts.
1138
1139 Hard case: The changes are not the same.
1140 This happens if the subsystem rebase had conflicts, or used
1141 --interactive to omit, edit, squash, or fixup commits; or if the
1142 upstream used one of commit --amend, reset, or a full history
1143 rewriting command like filter-repo[2].
1144
1145 The easy case
1146 Only works if the changes (patch IDs based on the diff contents) on
1147 subsystem are literally the same before and after the rebase subsystem
1148 did.
1149
1150 In that case, the fix is easy because git rebase knows to skip changes
1151 that are already present in the new upstream (unless
1152 --reapply-cherry-picks is given). So if you say (assuming you’re on
1153 topic)
1154
1155 $ git rebase subsystem
1156
1157 you will end up with the fixed history
1158
1159 o---o---o---o---o---o---o---o master
1160 \
1161 o'--o'--o'--o'--o' subsystem
1162 \
1163 *---*---* topic
1164
1165 The hard case
1166 Things get more complicated if the subsystem changes do not exactly
1167 correspond to the ones before the rebase.
1168
1169 Note
1170 While an "easy case recovery" sometimes appears to be successful
1171 even in the hard case, it may have unintended consequences. For
1172 example, a commit that was removed via git rebase --interactive
1173 will be resurrected!
1174
1175 The idea is to manually tell git rebase "where the old subsystem ended
1176 and your topic began", that is, what the old merge base between them
1177 was. You will have to find a way to name the last commit of the old
1178 subsystem, for example:
1179
1180 • With the subsystem reflog: after git fetch, the old tip of
1181 subsystem is at subsystem@{1}. Subsequent fetches will increase the
1182 number. (See git-reflog(1).)
1183
1184 • Relative to the tip of topic: knowing that your topic has three
1185 commits, the old tip of subsystem must be topic~3.
1186
1187 You can then transplant the old subsystem..topic to the new tip by
1188 saying (for the reflog case, and assuming you are on topic already):
1189
1190 $ git rebase --onto subsystem subsystem@{1}
1191
1192 The ripple effect of a "hard case" recovery is especially bad: everyone
1193 downstream from topic will now have to perform a "hard case" recovery
1194 too!
1195
1197 The interactive rebase command was originally designed to handle
1198 individual patch series. As such, it makes sense to exclude merge
1199 commits from the todo list, as the developer may have merged the
1200 then-current master while working on the branch, only to rebase all the
1201 commits onto master eventually (skipping the merge commits).
1202
1203 However, there are legitimate reasons why a developer may want to
1204 recreate merge commits: to keep the branch structure (or "commit
1205 topology") when working on multiple, inter-related branches.
1206
1207 In the following example, the developer works on a topic branch that
1208 refactors the way buttons are defined, and on another topic branch that
1209 uses that refactoring to implement a "Report a bug" button. The output
1210 of git log --graph --format=%s -5 may look like this:
1211
1212 * Merge branch 'report-a-bug'
1213 |\
1214 | * Add the feedback button
1215 * | Merge branch 'refactor-button'
1216 |\ \
1217 | |/
1218 | * Use the Button class for all buttons
1219 | * Extract a generic Button class from the DownloadButton one
1220
1221 The developer might want to rebase those commits to a newer master
1222 while keeping the branch topology, for example when the first topic
1223 branch is expected to be integrated into master much earlier than the
1224 second one, say, to resolve merge conflicts with changes to the
1225 DownloadButton class that made it into master.
1226
1227 This rebase can be performed using the --rebase-merges option. It will
1228 generate a todo list looking like this:
1229
1230 label onto
1231
1232 # Branch: refactor-button
1233 reset onto
1234 pick 123456 Extract a generic Button class from the DownloadButton one
1235 pick 654321 Use the Button class for all buttons
1236 label refactor-button
1237
1238 # Branch: report-a-bug
1239 reset refactor-button # Use the Button class for all buttons
1240 pick abcdef Add the feedback button
1241 label report-a-bug
1242
1243 reset onto
1244 merge -C a1b2c3 refactor-button # Merge 'refactor-button'
1245 merge -C 6f5e4d report-a-bug # Merge 'report-a-bug'
1246
1247 In contrast to a regular interactive rebase, there are label, reset and
1248 merge commands in addition to pick ones.
1249
1250 The label command associates a label with the current HEAD when that
1251 command is executed. These labels are created as worktree-local refs
1252 (refs/rewritten/<label>) that will be deleted when the rebase finishes.
1253 That way, rebase operations in multiple worktrees linked to the same
1254 repository do not interfere with one another. If the label command
1255 fails, it is rescheduled immediately, with a helpful message how to
1256 proceed.
1257
1258 The reset command resets the HEAD, index and worktree to the specified
1259 revision. It is similar to an exec git reset --hard <label>, but
1260 refuses to overwrite untracked files. If the reset command fails, it is
1261 rescheduled immediately, with a helpful message how to edit the todo
1262 list (this typically happens when a reset command was inserted into the
1263 todo list manually and contains a typo).
1264
1265 The merge command will merge the specified revision(s) into whatever is
1266 HEAD at that time. With -C <original-commit>, the commit message of the
1267 specified merge commit will be used. When the -C is changed to a
1268 lower-case -c, the message will be opened in an editor after a
1269 successful merge so that the user can edit the message.
1270
1271 If a merge command fails for any reason other than merge conflicts
1272 (i.e. when the merge operation did not even start), it is rescheduled
1273 immediately.
1274
1275 By default, the merge command will use the recursive merge strategy for
1276 regular merges, and octopus for octopus merges. One can specify a
1277 default strategy for all merges using the --strategy argument when
1278 invoking rebase, or can override specific merges in the interactive
1279 list of commands by using an exec command to call git merge explicitly
1280 with a --strategy argument. Note that when calling git merge explicitly
1281 like this, you can make use of the fact that the labels are
1282 worktree-local refs (the ref refs/rewritten/onto would correspond to
1283 the label onto, for example) in order to refer to the branches you want
1284 to merge.
1285
1286 Note: the first command (label onto) labels the revision onto which the
1287 commits are rebased; The name onto is just a convention, as a nod to
1288 the --onto option.
1289
1290 It is also possible to introduce completely new merge commits from
1291 scratch by adding a command of the form merge <merge-head>. This form
1292 will generate a tentative commit message and always open an editor to
1293 let the user edit it. This can be useful e.g. when a topic branch turns
1294 out to address more than a single concern and wants to be split into
1295 two or even more topic branches. Consider this todo list:
1296
1297 pick 192837 Switch from GNU Makefiles to CMake
1298 pick 5a6c7e Document the switch to CMake
1299 pick 918273 Fix detection of OpenSSL in CMake
1300 pick afbecd http: add support for TLS v1.3
1301 pick fdbaec Fix detection of cURL in CMake on Windows
1302
1303 The one commit in this list that is not related to CMake may very well
1304 have been motivated by working on fixing all those bugs introduced by
1305 switching to CMake, but it addresses a different concern. To split this
1306 branch into two topic branches, the todo list could be edited like
1307 this:
1308
1309 label onto
1310
1311 pick afbecd http: add support for TLS v1.3
1312 label tlsv1.3
1313
1314 reset onto
1315 pick 192837 Switch from GNU Makefiles to CMake
1316 pick 918273 Fix detection of OpenSSL in CMake
1317 pick fdbaec Fix detection of cURL in CMake on Windows
1318 pick 5a6c7e Document the switch to CMake
1319 label cmake
1320
1321 reset onto
1322 merge tlsv1.3
1323 merge cmake
1324
1326 rebase.backend
1327 Default backend to use for rebasing. Possible choices are apply or
1328 merge. In the future, if the merge backend gains all remaining
1329 capabilities of the apply backend, this setting may become unused.
1330
1331 rebase.stat
1332 Whether to show a diffstat of what changed upstream since the last
1333 rebase. False by default.
1334
1335 rebase.autoSquash
1336 If set to true enable --autosquash option by default.
1337
1338 rebase.autoStash
1339 When set to true, automatically create a temporary stash entry
1340 before the operation begins, and apply it after the operation ends.
1341 This means that you can run rebase on a dirty worktree. However,
1342 use with care: the final stash application after a successful
1343 rebase might result in non-trivial conflicts. This option can be
1344 overridden by the --no-autostash and --autostash options of git-
1345 rebase(1). Defaults to false.
1346
1347 rebase.missingCommitsCheck
1348 If set to "warn", git rebase -i will print a warning if some
1349 commits are removed (e.g. a line was deleted), however the rebase
1350 will still proceed. If set to "error", it will print the previous
1351 warning and stop the rebase, git rebase --edit-todo can then be
1352 used to correct the error. If set to "ignore", no checking is done.
1353 To drop a commit without warning or error, use the drop command in
1354 the todo list. Defaults to "ignore".
1355
1356 rebase.instructionFormat
1357 A format string, as specified in git-log(1), to be used for the
1358 todo list during an interactive rebase. The format will
1359 automatically have the long commit hash prepended to the format.
1360
1361 rebase.abbreviateCommands
1362 If set to true, git rebase will use abbreviated command names in
1363 the todo list resulting in something like this:
1364
1365 p deadbee The oneline of the commit
1366 p fa1afe1 The oneline of the next commit
1367 ...
1368
1369 instead of:
1370
1371 pick deadbee The oneline of the commit
1372 pick fa1afe1 The oneline of the next commit
1373 ...
1374
1375 Defaults to false.
1376
1377 rebase.rescheduleFailedExec
1378 Automatically reschedule exec commands that failed. This only makes
1379 sense in interactive mode (or when an --exec option was provided).
1380 This is the same as specifying the --reschedule-failed-exec option.
1381
1382 rebase.forkPoint
1383 If set to false set --no-fork-point option by default.
1384
1385 sequence.editor
1386 Text editor used by git rebase -i for editing the rebase
1387 instruction file. The value is meant to be interpreted by the shell
1388 when it is used. It can be overridden by the GIT_SEQUENCE_EDITOR
1389 environment variable. When not configured the default commit
1390 message editor is used instead.
1391
1393 The todo list presented by the deprecated --preserve-merges
1394 --interactive does not represent the topology of the revision graph
1395 (use --rebase-merges instead). Editing commits and rewording their
1396 commit messages should work fine, but attempts to reorder commits tend
1397 to produce counterintuitive results. Use --rebase-merges in such
1398 scenarios instead.
1399
1400 For example, an attempt to rearrange
1401
1402 1 --- 2 --- 3 --- 4 --- 5
1403
1404 to
1405
1406 1 --- 2 --- 4 --- 3 --- 5
1407
1408 by moving the "pick 4" line will result in the following history:
1409
1410 3
1411 /
1412 1 --- 2 --- 4 --- 5
1413
1415 Part of the git(1) suite
1416
1418 1. revert-a-faulty-merge How-To
1419 file:///usr/share/doc/git/howto/revert-a-faulty-merge.html
1420
1421 2. filter-repo
1422 https://github.com/newren/git-filter-repo
1423
1424
1425
1426Git 2.33.1 2021-10-12 GIT-REBASE(1)