← 返回命令列表

Linux command

merge 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Three-way merge

merge [file] [base] [other]

Output to different file

merge -p [file] [base] [other] > [merged]

Quiet mode

merge -q [file] [base] [other]

Show conflict markers

merge -A [file] [base] [other]

Merge with custom labels

merge -L [mine] -L [base] -L [theirs] [file] [base] [other]

说明

merge performs three-way file merge. It incorporates changes from _file3_ (relative to _file2_) into _file1_. The common ancestor _file2_ is used to determine which changes were made in each version. The tool is part of the RCS (Revision Control System) suite. When conflicts occur, merge writes conflict markers into _file1_ for manual resolution. The exit status is 0 for no conflicts, 1 if conflicts were found, or 2 for trouble.

参数

-p
Print to stdout.
-q
Quiet mode.
-A
Output conflicts using diff3 -A style (most verbose).
-E
Output conflicts using diff3 -E style (default).
-e
Like -E, but does not warn about conflicts.
-L _LABEL_
Use label instead of filename in conflict markers. May be given up to three times.
-V
Print RCS version number.

FAQ

What is the merge command used for?

merge performs three-way file merge. It incorporates changes from _file3_ (relative to _file2_) into _file1_. The common ancestor _file2_ is used to determine which changes were made in each version. The tool is part of the RCS (Revision Control System) suite. When conflicts occur, merge writes conflict markers into _file1_ for manual resolution. The exit status is 0 for no conflicts, 1 if conflicts were found, or 2 for trouble.

How do I run a basic merge example?

Run `merge [file] [base] [other]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -p do in merge?

Print to stdout.