假设我跑
git push --force origin master:master
(强制更新)
在另一个地方
git push origin +master:master
(非快进更新)
这两个是一样的吗?这 2 个行为不同的任何场景?
最佳答案
它们是相同的。来自docs :
All of the rules described above about what’s not allowed as an update can be overridden by adding an the optional leading
+
to a refspec (or using--force
command line option).
但是,也许很明显,--force
适用于所有被推送的内容,而 +
仅适用于以 +
为前缀的 refspec >(在本例中为 master
)。在您问题的两个命令中,这没有区别,因为它们中只有一个 refspec。
关于git - git push --force 与 git push 非快进更新之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54111065/