PyCharm 2021.1 Help

Apply Patch dialog

Use the dialog to apply changes from a patch file. For details, see Use patches

ItemTooltip and ShortcutDescription
Patch file nameSpecify the name of the *.patch file that you want to apply. Enter the fully qualified name or click Browse the Browse button and select the patch file in the dialog that opens.
Icons actions diffShow diff
Ctrl+D
Open the difference viewer that shows the differences between your local working copy, the repository version, and the patch.
Icons vcs foldersChange Directory PathsChoose how you want directory paths to be displyaed:
  • Map base directory: in the dialog that opens, select the directory relative to which file names in the patch file will be interpreted. You can map a base directory to a single file, directory, or selection.

  • Remove Leading Directory: apply the changes to files located in different directories from the ones specified in the patch. Clicking this button removes one slash in the path to the target file. Click the button as many times as many leading directories you need to remove. The number of removed slashes is indicated in square brackets.

  • Remove All Leading Directories: remove all leading directories with one click and apply the patch to the file with the specified name in the base directory.

  • Restore Leading Directory: revert the last Remove Leading Directory action. Click the button as many times as many previously stripped leading directories you need to restore.

  • Restore All Leading Directories: revert the Remove All Leading Directories action.

Icons actions refreshRefreshClick this button to synchronize the tree with the current state of the file system.
Icons actions group byGroup ByClick to select how you want to group files modified in the patch.
NameSelect an existing changelist or type the name of a new changelist where you want the patch to be added.
CommentEnter a comment to the new changelist.
Set activeSelect this checkbox to have PyCharm automatically give the active status to the new changelist immediately after the changes are restored in it. When this checkbox is cleared, the current active changelist remains active.
Track contextSelect this checkbox to have PyCharm preserve the context of the task associated with the new changelist on its deactivation and restore the context when the changelist becomes active. See Tasks and contexts for details.
Import to ShelfClick this button to move the patch contents to a shelf instead of applying it. A new changelist will the patch file be added to the Shelf tab of the Commit tool window Alt+0. You can review the changes and unshelve them when needed.

If the patch cannot be applied without conflicts, conflicting lines are highlighted in red.

Last modified: 08 March 2021