The manual says that -f means
Force the creation of extra revisions in order to explicitly record that files have been copied. Deleted source files are copied if they do not exist in the target, and files that are already identical are copied if they are not connected by existing integration records.
Honestly, I don't quite understand when p4 copy -f can be very useful. Could someone please show me some simple examples of the use cases of p4 copy -f?
Thank you.
If you’ve never encountered a situation where
p4 copy -fseems like it might be useful, count yourself lucky and forget about it; there are a number of options in Perforce that are only ever useful if you’ve already dug yourself a hole and are determined to keep digging, and this is one of them.That said, the classic case is:
fooin A.fooin B.If
foonever existed in C, it will not be included in a merge from C, so the change from step 3 is “lost” during the merge in step 5. Usingp4 copy -fin step 4 prevents this by creating a dummy file in C that can propagate the delete to A.Note that reparenting branches like this (going from A to B to C to A, rather than going from A to B to A) is not typically recommended as a best practice because it makes merging much more complicated in general.