[ImportNew] Perforce - Restoring Mistakenly Deleted Files in Workspace

本文介绍如何使用Perforce命令行工具p4diff和p4sync来查找并恢复在工作区中被误删除的文件。通过特定参数组合,可以有效定位丢失的文件,并使工作区与服务器上的仓库保持一致。

Shit happens when you accidentally delete some files in your workspace and you have no ideas which one is deleted. One way to find them is to use 'p4 diff' command.

p4 diff -sd

This will show only the names of unopened files that are missing from the client workspace, but present in the depot. Find those files and use the following to update those files in your workspace.

p4 sync -f <file>

Alternatively you can do this in a massive way by using:

p4 diff -sd | p4 -x - sync -f

This will update all the missing files in workspace and keep your workspace consistent with the depo on the server.

P.S. Using 'p4 sync' without '-f' will not sync the files from server to your workspace, because p4 has already synchronised the file for you and it is not aware of your deleting of it, as long as there are no new versions of the file, it will not sync it for you, unless you use '-f' parameter.

 

转载于:https://www.cnblogs.com/cheese-bacon/p/3619168.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值