"This branch cannot be rebased safely" stops our "rebase and merge" workflow

Hi!

In the GitHub - void-linux/void-packages: The Void source packages collection repository, we make the “rebase and merge” option mandatory, and it helps us a lot in keeping a linear history. Unfortunately, some time in the past week, many old PRs have suddenly greyed out the “Rebase and merge” button, with the following error:

This branch cannot be rebased safely
Rebasing the commits of this branch on top of the base branch cannot be performed automatically as this would create a different result than a regular merge. 

Some examples (not links because I’m a new user):

  • 29502
  • 29383

Even some new PRs are suffering from the same issue, for example:

  • 29975

This makes merging PRs a way more manual process (checking out the branch locally and pushing to master) and makes our experience with GH suboptimal.

A similar issue seems to have been reported in This branch cannot be rebased safely , but it wasn’t followed up and we hadn’t been affected until very recently. I assume something changed recently in how the “legality” of a rebase is determined, but it’s definitely too conservative.

Thanks!

A branch cannot merge safely when it has diverged too much from the tree. This usually happens if there’s a merge conflict so make sure you check if the PRs have conflicting changes from the upstream since the recent merge.

It’s not that there are conflicting changes, it just seems to be that if you are distant enough in terms of commits, github will refuse to rebase… Even if the files the commit touches have been untouched for even longer.

1 Like