Previous Table of Contents Index Next
Perforce 2012.1: Command Reference

p4 merge
Merge one set of files into another.
p4 [g-opts] merge [options] fromFile[revRange] toFile
p4 [g-opts] merge [options] -b branch [-r] [toFile[revRange] ...]
p4 [g-opts] merge [options] -b branch -s fromFile[revRange] [toFile ...]
p4 [g-opts] merge [options] -S stream [-P parent] [-F] [-r] [toFile[revRange]...]
options: -c change -n -m max
The p4 merge command is a simplified form of the p4 integrate command that merges a set of changes from source to target files. This command is intended for use with streams, but is also perfectly usable for traditional Perforce branches.
With streams, you use p4 merge to keep a child stream up to date with a more stable parent stream, to ensure that, when you promote changes back to the stable parent, you do not inadvertently overwrite any other changes that were checked into the parent. Files are opened in a pending changelist and scheduled for resolve as required. To update the parent stream, resolve and submit.
In most cases, you can use the p4 merge and p4 copy commands to propagate changes between streams (or branches). When p4 integrate schedules files for resolve, it selects the closest common ancestor as the base, and p4 merge selects (as the base) the revision with the most edits in common with the source and target.
-c change
-m max
Limits the number of files merged. This option is useful for scripts that integrate large number of files; it enables them to minimize the impact on server performance caused by locking by batching the integrations.
-b branch
-r [toFile[revRange] ...]
Reverses the mappings in the branch view, integrating from the target files to the source files. Requires the -b flag.
-s fromFile[revRange] [toFile ...]
Treat fromFile as the source and both sides of the branch view to as the target. To restrict the scope of the target further, specify the optional toFile parameter. Overrides the -r flag, if specified. Requires -b.
-S stream
Specifies the source stream. Files are merge to its parent stream. To merge from parent to child, specify the -r flag, which reverses the direction.
-P parent
Merge to the specified parent stream. Overrides the parent defined in the source stream specification.
Force merge operation; perform the operation when the target stream is not configured to accept a merge from the source. To determine a stream's expected flow of change, use p4 istat.
Usage Notes
Can File Arguments Use
Revision Specifier?
p4 merge -S //projectX/bruno_dev
p4 resolve
p4 submit -d "Update dev w latest changes"
Incorporate the latest changes from main into Bruno's development stream.
Related Commands

Previous Table of Contents Index Next

Perforce 2012.1: Command Reference
Copyright 1999-2012 Perforce Software.