Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Documentation | 2026.1

# P4MERGE

A third-party merge program to be used by `p4 resolve`'s merge option.

## Usage notes

Used by Client? | Used by Server? | Command-Line Alternative | Can be set in P4CONFIG file?
--- | --- | --- | ---
Yes | No | None | Yes

## Value if not explicitly set

Operating System | Value
--- | ---
All | If the `MERGE` environment variable is set, then its value; otherwise, nothing.

## Examples

`c:\Perforce\p4merge.exe` `c:\progra~1\Perforce\p4merge.exe`

## Notes

The program represented by the program name stored in this variable is used only by `p4 resolve`'s merge option. When `p4 resolve` calls this program, it passes four arguments, representing (in order) base, theirs, and yours, with the fourth argument holding the resulting merge file.

If the program you use takes its arguments in a different order, set `P4MERGE` to a shell script or batch file that reorders the arguments and calls the proper merge program with the arguments in the correct order.

If you are running under Windows, you must call a batch file, even if your third-party merge program already accepts arguments in the order provided by P4 Server. This is due to a limitation within Windows. For instance, if you want to use a program called `MERGE.EXE` under Windows, your batch file might look something like this:

    SET base=%1
    SET theirs=%2
    SET yours=%3
    SET merge=%4
    C:\FULL\PATH\TO\MERGE.EXE %base% %theirs% %yours% %merge%

Your search for returned results