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.
The steps to change a git branch name are: Rename the Git branch locally with the git branch -m new-branch-name command. Push the new branch to your GitHub or GitLab repo. Delete the branch with the old name from your remote repo.
No, in order to rename a remote Git branch you need to delete the old branch name, and then push the correctly named branch to the remote repository.
To do this, use the following steps: Switch to the master via the command “git checkout master”. Now enter the following command if you want to rename a Git branch: “git branch -m old-name new-name”. To ensure that the rename was successful, retrieve the current status of the branch using the “git branch -a” command.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With