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