IntelliJ IDEA 14.0.0 Web Help

Checking out (Switching Between Branches)

In this topic:

To check out an existing branch

  1. Invoke the Branches menu as described in the section Accessing Git Branches Popup Menu.
  2. On the pop-up list that shows all available local and remote branches, click the desired one, and choose Checkout on the submenu.
    git_branch_checkout

    The subsequent behavior depends on the presence of conflicts.

    • If your working tree is not dirty, or your local changes do not conflict with the specified branch, then this branch is checked out, which is reported in a balloon in the lower-left corner of the IntelliJ IDEA window.
    • If you are working with a dirty tree, and your local changes would be overwritten by checkout, IntelliJ IDEA shows the files that prevent checking branch out, and suggests to choose between force checkout, and smart checkout.
      git_smart_checkout

      Force checkout: local changes will be overwritten, like git checkout -f does.

      Smart checkout: IntelliJ IDEA stashes local changes, checks the branch out, and then unstashes changes back. If a conflict happens during unstash, merge dialog is shown.

To find out which branch is currently checked out in a local repository, do one of the following

  • View information about the current branch in the widget in the Status bar:
    git_widget
  • Invoke the Git Branches popup menu, and see the current branch name at the bottom line:
    git_current_branch1

See Also

Last modified: 12 November 2014
comments powered by Disqus