Git,将分支设置为不可合并

Git, set a branch as non-mergeable

我想将我在存储库中创建的分支标记为不可合并。

我没有使用 CI 或 中描述的 Jenkins。我只需要设置它以避免意外合并 master 分支中的 "experimental" 功能。

这可能吗?

您可以查看 protected branches in GitHub

这将避免任何合并,除非提供 status check 或 PR 审查。

另一种方法是,如果您管理自己的中央 Git 服务器,前提是添加挂钩以防止合并。
例如参见“pre-receive hook on server-side that refuse any push to master which has any non-linear history