Perforce:还原和强制同步有什么区别?
Perforce: what's the difference between a revert and a forced sync?
这两个命令有什么区别,如果有的话:
# revert my file to the revision last synced from the depot
p4 revert test.c
# force synchronization to refresh file and discard pending changes
p4 sync -f test.c
谢谢
我不相信 p4 sync -f
会丢弃您待处理的本地更改。使用 p4 revert
.
在您的场景中,命令类似,但是:
revert
只会还原当前标记为打开的文件; sync -f
只会覆盖未打开的文件。
revert
需要文件模式作为参数,sync -f
不需要。
sync -f
导致服务器向您发送文件的新副本,即使您当前的副本未修改,因此有点浪费计算机时间和网络资源。
还有其他差异,但它们对您的情况似乎不太重要。
在我看来,将工作空间 return 恢复为未修改状态的最佳方法实际上是使用 p4 clean
,它已在 2014.1 版中添加到服务器中。这是一篇关于 clean
命令的精彩文章:https://www.perforce.com/blog/140501/p4-clean-make-workspace-shine
对于其他替代方案,请参阅此相关问题:Perforce fast sync a directory to a clean state
这两个命令有什么区别,如果有的话:
# revert my file to the revision last synced from the depot
p4 revert test.c
# force synchronization to refresh file and discard pending changes
p4 sync -f test.c
谢谢
我不相信 p4 sync -f
会丢弃您待处理的本地更改。使用 p4 revert
.
在您的场景中,命令类似,但是:
revert
只会还原当前标记为打开的文件;sync -f
只会覆盖未打开的文件。revert
需要文件模式作为参数,sync -f
不需要。sync -f
导致服务器向您发送文件的新副本,即使您当前的副本未修改,因此有点浪费计算机时间和网络资源。
还有其他差异,但它们对您的情况似乎不太重要。
在我看来,将工作空间 return 恢复为未修改状态的最佳方法实际上是使用 p4 clean
,它已在 2014.1 版中添加到服务器中。这是一篇关于 clean
命令的精彩文章:https://www.perforce.com/blog/140501/p4-clean-make-workspace-shine
对于其他替代方案,请参阅此相关问题:Perforce fast sync a directory to a clean state