Apparently, this use case has been broken for a long time... Since bb52995f3e (format-patch: introduce format.useAutoBase configuration, 2016-04-26). I'm surprised it's only been reported now. This patchset fixes the breakage by teaching `git format-patch --no-base` and making rebase use it. Changes since v1: * Update some log messages Denton Liu (5): t3400: demonstrate failure with format.useAutoBase format-patch: fix indentation t4014: use test_config() format-patch: teach --no-base rebase: fix format.useAutoBase breakage Documentation/git-format-patch.txt | 5 +++-- builtin/log.c | 26 ++++++++++++++++++++++---- builtin/rebase.c | 3 ++- t/t3400-rebase.sh | 6 ++++++ t/t4014-format-patch.sh | 14 +++++++++----- 5 files changed, 42 insertions(+), 12 deletions(-) Range-diff against v1: 1: a1741e5434 ! 1: 4089e51041 t3400: demonstrate failure with format.useAutoBase @@ Commit message Ever since bb52995f3e (format-patch: introduce format.useAutoBase configuration, 2016-04-26), `git rebase` has been broken when - `format.useAutoBase = true`. Demonstrate that failure here. + `format.useAutoBase = true`. It fails when rebasing a branch that + doesn't have an upstream set: + + fatal: failed to get upstream, if you want to record base commit automatically, + please use git branch --set-upstream-to to track a remote branch. + Or you could specify base commit by --base=<base-commit-id> manually + error: + git encountered an error while preparing the patches to replay + these revisions: + + ede2467cdedc63784887b587a61c36b7850ebfac..d8f581194799ae29bf5fa72a98cbae98a1198b12 + + As a result, git cannot rebase them. + + Demonstrate that failure here. Reported-by: Christian Biesinger <cbiesinger@xxxxxxxxxx> 2: 46fd4113aa = 2: d288d6c3a5 format-patch: fix indentation 3: 22b1fb14f9 ! 3: 196b5d8dbc t4014: use `test_config` @@ Metadata Author: Denton Liu <liu.denton@xxxxxxxxx> ## Commit message ## - t4014: use `test_config` + t4014: use test_config() Instead of manually unsetting the config after the test case is done, - use `test_config` to do it automatically. While we're at it, fix a typo + use test_config() to do it automatically. While we're at it, fix a typo in a test case name. ## t/t4014-format-patch.sh ## 4: e072c36e6a = 4: f7e5325cc0 format-patch: teach --no-base 5: 15e6ccb203 ! 5: 62c59c12e3 rebase: fix `format.useAutoBase` breakage @@ Metadata Author: Denton Liu <liu.denton@xxxxxxxxx> ## Commit message ## - rebase: fix `format.useAutoBase` breakage + rebase: fix format.useAutoBase breakage With `format.useAutoBase = true`, running rebase resulted in an - error when an upstream was't set: + error when an upstream wasn't set: fatal: failed to get upstream, if you want to record base commit automatically, please use git branch --set-upstream-to to track a remote branch. -- 2.24.0.504.g3cd56eb17d