问题描述
当我想强制推送时,我几乎总是使用 --force-with-lease
。今天我升级到 Git 2.30 并发现了一个新选项:--force-if-includes
。
阅读 updated documentation 后,我仍然不完全清楚在什么情况下我会像往常一样使用 --force-if-includes
而不是 --force-with-lease
。
解决方法
为了避免意外覆盖其他开发者的提交,我最终最安全的解决方案是这样的,同时使用 2 个选项
[alias]
pushf = push --force-with-lease --force-if-includes