[ImportNew] Perforce

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