gvlasov
gvlasov

Reputation: 20015

How to rename a local Git branch from inside IntelliJ IDEA?

There are plenty of things you can do with Git plugin for IntelliJ IDEA, but I haven't found a way to rename a branch. Is there one?

I know I can always bring up a terminal and do git branch -m source target, but I expected to find a GUI solution as well.

Upvotes: 12

Views: 12106

Answers (2)

Pavlo Zvarych
Pavlo Zvarych

Reputation: 645

VCS > Git > Branches...

  1. Click on the right arrow of your project (look at Repositories).

  2. The sub-window with branches will appear. Click on the right arrow of the branch you want to rename.

  3. Rename.

If you want to rename a branch you currently on. You have to checkout to another branch and then to find your branch in a way described above and rename it.

enter image description here

Upvotes: 5

VonC
VonC

Reputation: 1324737

There are a couple of pending issues with this feature:

The latter is not yet implemented.
The former does show the only way (mentioned by the OP) currently available:

Go to the command line and execute git branch -m <old_name> <new_name>

But even that has refresh issue on IDEA.


Update January 2017: IDEA-131021 might have been implemented, as illustrated by Pavlo Zvarych's answer. It is consistent with the proposal:

introduce menu item in Git | Branches popup for current branch and place the actions related to the current branch in its second-level submenu.

https://youtrack.jetbrains.com/_persistent/image.png?file=74-343247&c=true&rw=526&rh=121&u=1473876457355

Upvotes: 14

Related Questions