Simpler and more powerful UI for Git branches

Lightweight and fast branches are one of the major features and advantages of Git. We in Jetbrains want to make workflow with branches even more convenient and simple than it is in command line.

You might have noticed that in IntelliJ IDEA 11.0 we’ve added new interface to checkout branches from Git. In IntelliJ IDEA 11.1 we have polished the look and feel, and made it more functional. The main goal of new interface is to concentrate on the most common use cases. Let’s take a look at the features which the IDE offers to manage Git branches.

The Git branch popup menu is available from Main Menu | VCS | Git | Branches, from Context Menu | Git | Branches, from the VCS Operations Popup, and also when you click the widget in the status bar, which shows the current Git branch. Personally, I prefer using keyboard, and I’ve assigned a shortcut (Settings | Keymap) to the action.

The popup shows the list of all local and remote branches available. Each branch can be checked out, compared or merged with current branch or deleted.

You may also create and checkout a new branch (like git checkout -b <branch>) and checkout a specific revision or tag.

Have a look at each of these features, since there are some niceties which IntelliJ IDEA offers to user.


Usually when you checkout a branch, you have clean working tree, and everything just works. But sometimes you may want to checkout with dirty working tree, and if the local changes would be overwritten by checkout, Git fails with an error.

IntelliJ IDEA handles this situation and offers Smart checkout, which shows the files preventing checkout and offers to stash local changes, checkout the branch, and then unstash changes back. If a conflict happens during unstash, merge dialog is shown.

Checkout as new local branch is just a shorthand for Checkout + New branch. It can be useful if you work on a feature branch and want to start another feature from master.

Checkout remote branch as new local branch serves the same purpose, but in addition to that it sets ups tracking.


The merge action merges selected branch into the current branch, simply like git merge <branch>. Common workflow is create a feature branch, make changes there, checkout master and merge feature to master.

Merge also captures the error we talked above and proposes Smart merge procedure. On conflict it opens merge dialog.

We have plans to add rebase action here as well, but rebase operation is much more complex than merge, so it will take time. Stay tuned.

When a local branch is merged, you can delete it right away.


Deleting a local branch fully merged to the current branch is very simple. Just select it in the list, select Delete, and that’s all.

However if a branch is not fully merged, you’ll get a helpful dialog which shows the warning together with the list of unmerged commits and the list of branches selected branch is merged to (if there are such branches). Based on this information you may make a decision to delete the branch right away.

Remote branch is deleted, as usual via git push <remote> :<branch>, but since it is a potentially dangerous operation, it is made with confirmation. If you have local branches tracking the remote branch, you may delete them as well.


There are two modes of branches comparison: git log and git diff.

Select a branch from the popup and choose Compare. You’ll get a dialog, where there are commits existing in current branch and absent in selected branch, and vice versa.

The diff view allows to show the difference between branches in a single file tree.

That’s all about Git branches for today. We’ll talk more about projects with multiple Git roots configuration in the next post. Stay tuned!

We are looking forward for your feedback on the Git branches new interface. Your suggestions are welcome here and in our issue tracker as always. Please post bugreports directly to the tracker.

This entry was posted in New Features and tagged , . Bookmark the permalink.

18 Responses to Simpler and more powerful UI for Git branches

  1. Brice says:

    This is great.

    It would be great to see the same kind of UI for Mercurial.

  2. Dan Stefan Oprean says:

    See this is the kind of love Mercurial is missing, oh and this is what makes Idea so damn great.

  3. Uzi says:

    love the stash-checkout-unstash automation…

  4. Artur says:

    But there is still nothing for handling tags .. :(

  5. Kevin says:

    It would be really excellent if Pull/Push/Fetch were added as shortcuts in the plugin pane somewhere, instead of from the VCS drop down menu at the top. That’s my only real complaint with the plugin.

  6. Martin says:

    When will the next Git post be ready?

  7. Kirill Likhodedov says:

    Do you want Pull/Push/Fetch to be added to the popup menu described in the topic? Or you just want an easier access to these functions? In the latter case you may want to use the VCS Operations Popup, or make your own Quick List.

  8. AaronLS says:

    When I’m in the changes window and I do compares, or compare to local, most of the windows just show checksum’s at the top. I haven’t a clue what is being compared with? Local branch, remote repo? Really confusing when you have your personal remote repo and your upstream remote repo.

    The diff window should label the left and right file better at the top.

  9. Kirill Likhodedov says:

    Yep, that is a known problem, please vote:

  10. Andrea says:

    It would be great if you were able to search the branch , when you have many branches is imposible to select now.

  11. Tony says:

    I’m greatly missing the compare between 2 commits. (in the history)

    And the compare with local too.

    Used it a lot to see if commit were squashabble…

  12. chen says:

    What about a quick commit option? without a dialog, something similar to vs code vcs tool window?

  13. John says:

    Why does the checkout as new local branch of a remote track the original remote (and push to it)? If I then manually push to a new remote, it is still tracking the old. Is there anyway to change this.

    I was expecting this to work just like branching a local, i.e. it creates a new local branch and that branch (by default) pushes to a new remote and then tracks it. I guess I can see it tracking initially the original remote, but seems like it should give you a choice.

    • Dmitriy Smirnov says:

      Checkout as anew local branch executes git checkout -b LocalBranch remotebranch command which sets the tracking.

      If you want to create a new branch without tracked remote, use the New branch action. This action behaves as a local branching.

Leave a Reply

Your email address will not be published. Required fields are marked *