Han He
Han He

Reputation: 3461

How to fully sync two branches in perforce

I want to overwrite all files in branch B with another branch A. The use case is:

Is these a quick way to achieve this?
p4 branch would lead to a new branch C. And p4 integrate would keep the changes on B.

One possible way is, remove all files of B, and copy all files of A to B, and then run p4 reconcile on B. It's a little complicated. Anyone know a quick way? Thanks in advance.

Upvotes: 2

Views: 1770

Answers (1)

P4Jen
P4Jen

Reputation: 1033

'p4 copy' will copy files from one branch to another:

https://www.perforce.com/perforce/r16.1/manuals/cmdref/p4_copy.html

The previous history of branch B will still remain.

If you wish for it to look as if branch B was always an exact copy of branch A, then you may wish to obliterate it and re-create it.

Note that 'p4 obliterate' completely removes data from Perforce, so should be used with care and backups should be taken before running it.

More information about this command is here:

https://www.perforce.com/perforce/r16.1/manuals/cmdref/p4_obliterate.html

Hope this helps, Jen.

Upvotes: 2

Related Questions