@@ -243,11 +243,15 @@ leave out at most one of A and B, in which case it defaults to HEAD.
243
243
--keep-empty::
244
244
Keep the commits that do not change anything from its
245
245
parents in the result.
246
+ +
247
+ See also INCOMPATIBLE OPTIONS below.
246
248
247
249
--allow-empty-message::
248
250
By default, rebasing commits with an empty message will fail.
249
251
This option overrides that behavior, allowing commits with empty
250
252
messages to be rebased.
253
+ +
254
+ See also INCOMPATIBLE OPTIONS below.
251
255
252
256
--skip::
253
257
Restart the rebasing process by skipping the current patch.
@@ -271,6 +275,8 @@ branch on top of the <upstream> branch. Because of this, when a merge
271
275
conflict happens, the side reported as 'ours' is the so-far rebased
272
276
series, starting with <upstream>, and 'theirs' is the working branch. In
273
277
other words, the sides are swapped.
278
+ +
279
+ See also INCOMPATIBLE OPTIONS below.
274
280
275
281
-s <strategy>::
276
282
--strategy=<strategy>::
@@ -280,15 +286,19 @@ other words, the sides are swapped.
280
286
+
281
287
Because 'git rebase' replays each commit from the working branch
282
288
on top of the <upstream> branch using the given strategy, using
283
- the 'ours' strategy simply discards all patches from the <branch>,
289
+ the 'ours' strategy simply empties all patches from the <branch>,
284
290
which makes little sense.
291
+ +
292
+ See also INCOMPATIBLE OPTIONS below.
285
293
286
294
-X <strategy-option>::
287
295
--strategy-option=<strategy-option>::
288
296
Pass the <strategy-option> through to the merge strategy.
289
297
This implies `--merge` and, if no strategy has been
290
298
specified, `-s recursive`. Note the reversal of 'ours' and
291
299
'theirs' as noted above for the `-m` option.
300
+ +
301
+ See also INCOMPATIBLE OPTIONS below.
292
302
293
303
-S[<keyid>]::
294
304
--gpg-sign[=<keyid>]::
@@ -324,17 +334,21 @@ which makes little sense.
324
334
and after each change. When fewer lines of surrounding
325
335
context exist they all must match. By default no context is
326
336
ever ignored.
337
+ +
338
+ See also INCOMPATIBLE OPTIONS below.
327
339
328
- -f ::
340
+ --no-ff ::
329
341
--force-rebase::
330
- Force a rebase even if the current branch is up to date and
331
- the command without `--force` would return without doing anything.
342
+ -f::
343
+ Individually replay all rebased commits instead of fast-forwarding
344
+ over the unchanged ones. This ensures that the entire history of
345
+ the rebased branch is composed of new commits.
332
346
+
333
- You may find this (or --no-ff with an interactive rebase) helpful after
334
- reverting a topic branch merge, as this option recreates the topic branch with
335
- fresh commits so it can be remerged successfully without needing to "revert
336
- the reversion" (see the
337
- link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details).
347
+ You may find this helpful after reverting a topic branch merge, as this option
348
+ recreates the topic branch with fresh commits so it can be remerged
349
+ successfully without needing to "revert the reversion" (see the
350
+ link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for
351
+ details).
338
352
339
353
--fork-point::
340
354
--no-fork-point::
@@ -355,19 +369,22 @@ default is `--no-fork-point`, otherwise the default is `--fork-point`.
355
369
--whitespace=<option>::
356
370
These flag are passed to the 'git apply' program
357
371
(see linkgit:git-apply[1]) that applies the patch.
358
- Incompatible with the --interactive option.
372
+ +
373
+ See also INCOMPATIBLE OPTIONS below.
359
374
360
375
--committer-date-is-author-date::
361
376
--ignore-date::
362
377
These flags are passed to 'git am' to easily change the dates
363
378
of the rebased commits (see linkgit:git-am[1]).
364
- Incompatible with the --interactive option.
379
+ +
380
+ See also INCOMPATIBLE OPTIONS below.
365
381
366
382
--signoff::
367
383
Add a Signed-off-by: trailer to all the rebased commits. Note
368
384
that if `--interactive` is given then only commits marked to be
369
- picked, edited or reworded will have the trailer added. Incompatible
370
- with the `--preserve-merges` option.
385
+ picked, edited or reworded will have the trailer added.
386
+ +
387
+ See also INCOMPATIBLE OPTIONS below.
371
388
372
389
-i::
373
390
--interactive::
@@ -378,6 +395,8 @@ default is `--no-fork-point`, otherwise the default is `--fork-point`.
378
395
The commit list format can be changed by setting the configuration option
379
396
rebase.instructionFormat. A customized instruction format will automatically
380
397
have the long commit hash prepended to the format.
398
+ +
399
+ See also INCOMPATIBLE OPTIONS below.
381
400
382
401
-r::
383
402
--rebase-merges[=(rebase-cousins|no-rebase-cousins)]::
@@ -404,7 +423,7 @@ It is currently only possible to recreate the merge commits using the
404
423
`recursive` merge strategy; Different merge strategies can be used only via
405
424
explicit `exec git merge -s <strategy> [...]` commands.
406
425
+
407
- See also REBASING MERGES below.
426
+ See also REBASING MERGES and INCOMPATIBLE OPTIONS below.
408
427
409
428
-p::
410
429
--preserve-merges::
@@ -415,6 +434,8 @@ See also REBASING MERGES below.
415
434
This uses the `--interactive` machinery internally, but combining it
416
435
with the `--interactive` option explicitly is generally not a good
417
436
idea unless you know what you are doing (see BUGS below).
437
+ +
438
+ See also INCOMPATIBLE OPTIONS below.
418
439
419
440
-x <cmd>::
420
441
--exec <cmd>::
@@ -437,6 +458,8 @@ squash/fixup series.
437
458
+
438
459
This uses the `--interactive` machinery internally, but it can be run
439
460
without an explicit `--interactive`.
461
+ +
462
+ See also INCOMPATIBLE OPTIONS below.
440
463
441
464
--root::
442
465
Rebase all commits reachable from <branch>, instead of
@@ -447,6 +470,8 @@ without an explicit `--interactive`.
447
470
When used together with both --onto and --preserve-merges,
448
471
'all' root commits will be rewritten to have <newbase> as parent
449
472
instead.
473
+ +
474
+ See also INCOMPATIBLE OPTIONS below.
450
475
451
476
--autosquash::
452
477
--no-autosquash::
@@ -461,11 +486,11 @@ without an explicit `--interactive`.
461
486
too. The recommended way to create fixup/squash commits is by using
462
487
the `--fixup`/`--squash` options of linkgit:git-commit[1].
463
488
+
464
- This option is only valid when the `--interactive` option is used.
465
- +
466
489
If the `--autosquash` option is enabled by default using the
467
490
configuration variable `rebase.autoSquash`, this option can be
468
491
used to override and disable this setting.
492
+ +
493
+ See also INCOMPATIBLE OPTIONS below.
469
494
470
495
--autostash::
471
496
--no-autostash::
@@ -475,17 +500,73 @@ used to override and disable this setting.
475
500
with care: the final stash application after a successful
476
501
rebase might result in non-trivial conflicts.
477
502
478
- --no-ff::
479
- With --interactive, cherry-pick all rebased commits instead of
480
- fast-forwarding over the unchanged ones. This ensures that the
481
- entire history of the rebased branch is composed of new commits.
482
- +
483
- Without --interactive, this is a synonym for --force-rebase.
484
- +
485
- You may find this helpful after reverting a topic branch merge, as this option
486
- recreates the topic branch with fresh commits so it can be remerged
487
- successfully without needing to "revert the reversion" (see the
488
- link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details).
503
+ INCOMPATIBLE OPTIONS
504
+ --------------------
505
+
506
+ git-rebase has many flags that are incompatible with each other,
507
+ predominantly due to the fact that it has three different underlying
508
+ implementations:
509
+
510
+ * one based on linkgit:git-am[1] (the default)
511
+ * one based on git-merge-recursive (merge backend)
512
+ * one based on linkgit:git-cherry-pick[1] (interactive backend)
513
+
514
+ Flags only understood by the am backend:
515
+
516
+ * --committer-date-is-author-date
517
+ * --ignore-date
518
+ * --whitespace
519
+ * --ignore-whitespace
520
+ * -C
521
+
522
+ Flags understood by both merge and interactive backends:
523
+
524
+ * --merge
525
+ * --strategy
526
+ * --strategy-option
527
+ * --allow-empty-message
528
+
529
+ Flags only understood by the interactive backend:
530
+
531
+ * --[no-]autosquash
532
+ * --rebase-merges
533
+ * --preserve-merges
534
+ * --interactive
535
+ * --exec
536
+ * --keep-empty
537
+ * --autosquash
538
+ * --edit-todo
539
+ * --root when used in combination with --onto
540
+
541
+ Other incompatible flag pairs:
542
+
543
+ * --preserve-merges and --interactive
544
+ * --preserve-merges and --signoff
545
+ * --preserve-merges and --rebase-merges
546
+ * --rebase-merges and --strategy
547
+ * --rebase-merges and --strategy-option
548
+
549
+ BEHAVIORAL DIFFERENCES
550
+ -----------------------
551
+
552
+ * empty commits:
553
+
554
+ am-based rebase will drop any "empty" commits, whether the
555
+ commit started empty (had no changes relative to its parent to
556
+ start with) or ended empty (all changes were already applied
557
+ upstream in other commits).
558
+
559
+ merge-based rebase does the same.
560
+
561
+ interactive-based rebase will by default drop commits that
562
+ started empty and halt if it hits a commit that ended up empty.
563
+ The `--keep-empty` option exists for interactive rebases to allow
564
+ it to keep commits that started empty.
565
+
566
+ * directory rename detection:
567
+
568
+ merge-based and interactive-based rebases work fine with
569
+ directory rename detection. am-based rebases sometimes do not.
489
570
490
571
include::merge-strategies.txt[]
491
572
0 commit comments