PyCharm 5.0 Help

Merging, Deleting, and Comparing Branches

In this topic:

To merge a branch

  1. Invoke the Branches menu as described in Accessing Git Branches Popup Menu.
  2. Select a branch in the pop-up list that shows all available local and remote branches, and choose Merge from the submenu. The selected branch will be merged into the branch that is currently checked out.

    If there are merge conflicts, you will be prompted to resolve them.

    If your local changes are going to be overwritten by merge, PyCharm suggests to perform smart merge (similar to smart checkout.

To delete a branch

  1. Invoke the Branches menu as described in Accessing Git Branches Popup Menu.
  2. Select a branch in the pop-up list that shows all available local and remote branches, and choose Delete from the submenu.

    If there are no unmerged commits, the selected branch will be deleted.

    If there are commits that have not yet been merged into the selected branch, a dialog will open with a list of unmerged changes, and the list of branches where the selected branch has already been merged into. This information should help you decide if you still want to delete the selected branch.

    git_delete_branch

    If you are sure you want to delete the selected branch, click Delete and confirm the operation.

To compare branches

  1. Invoke the Branches menu as described in Accessing Git Branches Popup Menu.
  2. Select a branch in the pop-up list that shows all available local and remote branches, and choose Compare from the submenu.

    PyCharm compares the branch that is currently checked out with the selected branch.

  3. In the dialog that opens, compare the differences in the following two tabs:
    • Log: this tab lists the commits that exist in the current branch, and are missing in the selected branch, and vice versa.
    • Diff: this tab shows the differences between files existing in both branches. Use the Show Diff command on the context menu of a file to explore the differences between branches.

See Also

Last modified: 10 December 2015