Merging Files from Command Line
You can use PyCharm as a command line tool for merging files.
Most often you need to merge three versions of the same file: your local version, the version in the repository or in the upstream, and the base revision, which is the origin for the two diverged versions.
In the command line, run the
merge
command using the following syntax:<PyCharm> merge path1 path2 path3 output
It is also possible to pass only three arguments to the merge
tool. In this case, the contents of the output
will serve as the base revision.
In the command line, run the
merge
command using the following syntax:<PyCharm> merge path1 path2 output
The selected files will be opened in the Merge dialog allowing you to accept or discard each change individually.
The command options are as follows:
Option | Description |
---|---|
| The platform-specific PyCharm launcher. On macOS and Linux, it is recommended to use the command-line launcher created during the PyCharm installation, or create one manually by selecting on the PyCharm main menu. Refer to Besides working from within PyCharm, you can perform the following actions from the command line: for details. On Windows, it is recommended to add the path to the PyCharm executable to the |
| The path to the local copy of the file. |
| The path to the repository version of the file. |
| (optional) The path to the base revision for |
| The path to the file to save the merge results in. |
Examples
- Syntax
-
pycharm.exe merge path1 path2 path3 output
- Example
-
pycharm.exe merge C:\MyProject\Readme.md.bak C:\MyProject\Readme.md C:\Archive\Readme.md C:\NewProject\Readme.md
- Syntax
-
pycharm merge path1 path2 path3 output
- Example
-
pycharm merge ~/MyProject/Readme.md.bak ~/MyProject/Readme.md ~/Archive/Readme.md ~/NewProject/Readme.md