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