IntelliJ IDEA 2016.3 Help

Checking out (Switching Between) Branches

On this page:

Checking out an existing 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 Checkout from the submenu.

    What happens next depends on whether there are conflicts:

    • If your working tree is clean and your local changes do not conflict with the specified branch, this branch will be checked out (a notification will popup in the bottom-left corner of the IntelliJ IDEA window).
    • If you ware working with a dirty tree, and your local changes will be overwritten by checkout, IntelliJ IDEA shows the files that prevent you from checking out the selected branch, and suggests to choose between the force checkout and smart checkout.

      If you select force checkout, your local changes will be overwritten (equivalent to the git checkout -f command).

      If you select smart checkout, IntelliJ IDEA will stash local changes, check out the selected branch, and then unstash the changes. If a conflict occurs during the unstash operation, you will be prompted to merge the changes.

Checking which branch is currently checked out

If you want to check which branch is you are currently working in, do one of the following:

See Also

Last modified: 21 March 2017