PyCharm 2017.2 Help

Create Patch Dialog

VCS | Create Patch
View | Tool Windows | Version Control - Local Changes - Context menu of a file or changelist - Create Patch


Use this dialog box to generate a patch file for the specified changelist or files.

Use this dialog box to create a patch from the selected changelist or files.

This dialog box consists of several areas:

Modified files pane

This section contains a list of files that were modified since the last commit. All files in this list are selected by default. Deselect the check-boxes next to the files that you want to exclude from the patch.

Toolbar

ItemTooltip and ShortcutDescriptionAvailable in
/help/img/idea/2017.2/icon_showDiff.png Show Differences
Ctrl+D
Click this button to open the Differences dialog box that highlights the differences between your local working copy of the selected file and its repository version. All VCSs
/help/img/idea/2017.2/refresh.png Refresh Changes
Ctrl+F5
Click this button to reload the Changed files tree view so it is up-to-date. All VCSs
/help/img/idea/2017.2/show_unversioned_icon.png Show Unversioned Files Click this button if you want to see newly added files that have not been added to version control yet under the Unversioned Files node. ALl VCSs
/help/img/idea/2017.2/add.png Add to VCS
Ctrl+Alt+A
Click this button to move the files selected under the Unversioned Files node to the active changelist, so that they are added to your version control system during the commit. All VCSs
/help/img/idea/2017.2/moveToOtherChangelist.png Move to Another Changelist
F6
Click this button to add the selected file(s) to another changelist. The Move to Another Changelist dialog box opens where you can select an existing changelist or create a new one. All VCSs
/help/img/idea/2017.2/delete.png Delete Click this button to delete the selected file.
/help/img/idea/2017.2/properties.gif Ignore Click this button to leave the selected files unversioned. All VCSs
/help/img/idea/2017.2/rollback.png Revert Click this button to revert all changes made to the local working copy of the selected files. All VCSs
/help/img/idea/2017.2/edit.png Jump to source
F4
Click this button to open the source code of the selected file in the editor.All VCSs
/help/img/idea/2017.2/vcsToolbarRevertUnchangedIcon.png Revert Unchanged FilesClick this button to revert the files that have not been modified locally. Subversion
Perforce
/help/img/idea/2017.2/vcsToolbarGroupByDirIcon.png Group by Directory
Ctrl+P
Click this button to toggle between the flat view and the directory tree view. All VCSs
/help/img/idea/2017.2/expandAll.png
/help/img/idea/2017.2/collapseAll.png
Expand or collapse all nodes
Ctrl+NumPad Plus
Ctrl+NumPad -
Click these buttons to expand or collapse all nodes in the directory tree. These buttons are not available in flat view. All VCSs
Change list N/A From this drop-down list, select the changelist that contains the modified files to be checked in or included in the patch. The active changelist is selected by default. All VCSs

The summary under the modified files pane shows statistics on the currently selected changelist, such as the number of modified, new and deleted files. This area also shows how many files of each type are shown, and how many of them will be included in the patch.

Commit Message pane

The comment you enter in this area will be used as the name of the patch file.

Toolbar

Icon and TooltipShortcutDescription
/help/img/idea/2017.2/commit_message_history.png Commit Message HistoryCtrl+MClick this icon to invoke the Commit Message History dialog that contains a list of your twenty-five last commits and the corresponding commit messages.

Details pane

The Details pane is hidden by default. To unfold it, click the arrow button /help/img/idea/2017.2/unfold.png next to the pane title.

In this pane you can explore the differences between the base repository version of the selected file, and the version you want to include in the patch.

Toolbar

ItemTooltip and ShortcutDescription
/help/img/idea/2017.2/arrowUp.png/help/img/idea/2017.2/arrowDown.pngPrevious Difference / Next Difference Shift+F7 F7
Use these buttons to jump to the next/previous difference.

When the last/first difference is hit, PyCharm suggests to click the arrow buttons F7/Shift+F7 once more and compare other files, depending on the Go to the next file after reaching last change option in the Differences Viewer settings.

This behavior is supported only when the Differences Viewer is invoked from the Version Control tool window.

/help/img/idea/2017.2/comparePreviousFile.png
/help/img/idea/2017.2/compareNextFile.png
Compare Previous/Next File
Alt+LeftAlt+Right
Click these buttons to compare the local copy of the previous/next file with its update from the server.
/help/img/idea/2017.2/edit.png Jump to Source
F4
Click this button to open the selected file in the active pane in the editor. The caret will be placed in the same position as in the Differences Viewer.
Viewer type
/help/img/idea/2017.2/diffViewer_type.png
Use this drop-down list to choose the desired viewer type. The side-by-side viewer has two panels; the unified viewer has one panel only.

Both types of viewers enable you to

  • Edit code. Note that one can change text only in the right-hand part of the default viewer, or, in case of the unified viewer, in the lower ("after") line, i.e. in your local version of the file.
  • Perform the Apply/Append/Revert actions.
Whitespace
/help/img/idea/2017.2/diffViewer_whitespaces.png
Use this drop-down list to define how the differences viewer should treat white spaces in the text.
  • Do not ignore: white spaces are important, and all differences are highlighted. This option is selected by default.
  • Trim whitespaces: ("\t", " "), if they appear in the end and in the beginning of a line.
    • If two lines differ in trailing whitespaces only, these lines are considered equal.
    • If two lines are different, such trailing whitespaces are not highlighted in the By word mode.
  • Ignore whitespaces: white spaces are not important, regardless of their location in the source code.
  • Ignore whitespaces and empty lines: the following entities are ignored:
    • all whitespaces (as in the 'Ignore whitespaces' option)
    • all added or removed lines consisting of whitespaces only
    • all changes consisting of splitting or joining lines without changes to non-whitespace parts.
      For example, changing a b c to a \n b c is not highlighted in this mode.
Highlighting mode
/help/img/idea/2017.2/diffViewer_highlight.png
Select the way differences granularity is highlighted.
The available options are:
  • Highlight words: the modified words are highlighted
  • Highlight lines: the modified lines are highlighted
  • Highlight split changes: if this option is selected, big changes are split into smaller 'atomic' changes.
    For example, A \n B vs. A X \n B X will be treated as two changes instead of one.
  • Do not highlight: if this option is selected, the differences are not highlighted at all. This option is intended for significantly modified files, where highlighting only introduces additional difficulties.
/help/img/idea/2017.2/collapseAll.png Collapse unchanged fragmentsClick this button to collapse all unchanged fragments in both files. The amount of non-collapsible unchanged lines is configurable in the Diff & Merge settings page.
/help/img/idea/2017.2/sync_scrolling.png Synchronize scrolling Click this button to scroll both differences panes simultaneously. If this button is released, each pane can be scrolled independently.
/help/img/idea/2017.2/disable_editing.png Disable editing Click this button to enable editing of the local copy of the selected file, which is disabled by default. When editing is enabled, you can make last-minute changes to the modified file before committing it.
/help/img/idea/2017.2/cogwheel_blue_with_arrow.png Editor settings Click this button to open a drop-down list of available options. Select or clear these options to show or hide line numbers, indentation guides, white spaces, and soft wraps.
/help/img/idea/2017.2/external_tool.pngShow diff in external toolClick this button to invoke an external differences viewer, specified in the External Diff Tools settings page.

This button only appears on the toolbar when the Use external diff tool option is enabled in the External Diff Tools settings page.

/help/img/idea/2017.2/icon_help.pngHelp
F1
Click this button to show the corresponding help page.

Note that the options listed above are available for text files only. PyCharm cannot compare binary files, so most commands will be unavailable for them.

After you've selected the files you want to commit, click the Create Patch button and specify the patch file options in the dialog that opens.

Last modified: 26 October 2017

See Also

Procedures:

Concepts: