How to Rename Branch Name in GIT


Using Terminal or command prompt

To rename a Git branch, you can use the git branch command with the -m option and the new branch name.

  • To rename the current branch, use git branch -m new-branch-name
  • To rename a specific branch, use git branch -m old-branch-name new-branch-name
  • To propagate the change to a remote, use git push origin -u new-branch-name and git push origin --delete old-branch-name
  • To verify the renaming, use git branch -a or git branch


If you're using Windows and want to change only the capitalization in the branch name, use -M instead of -m.


Using IntelliJ IDEA

You can also rename a branch in IntelliJ IDEA by:
  1. Selecting the branch you want to rename in the Branches popup or pane
  2. Choosing Rename
  3. Changing the branch name in the dialog

Above changes are verified on terminal.