我怎样才能安全地 git rebase master 中的提交历史

How can I safely git rebase commit history in master

我的新团队没有以最有效的方式使用 git,我的领导要求我清理回购协议。他们都在 master 之外工作——而不是创建分支。 master 中有很多小的提交。我创建了一个新分支 bug_rebase_history 并重新设置压缩提交的基础,直到每天有一个提交。这将 master 中的提交从 465 减少到 180。

我如何在 GitLab Web 界面中创建一个合并请求,以一种不只是在 HEAD 顶部添加新的压缩提交的方式合并此变基?有更安全的方法吗?

How can I create a merge request in the GitLab web interface that will merge this rebase in a way that won't just add the new squashed commits on top of the HEAD?

不可能。

从分支删除 提交的唯一方法是reset 分支然后强制将其推回。如果你 re-write 一个受保护的分支,你将需要强制将该分支从客户端工具中推出(并且可能暂时授予你自己 force-push 受保护分支的权限)。

合并(或拉取)请求可以带来(合并)新的提交,但不能从分支中删除任何提交。