skip to content
Keshav Mohta

Rename Git Branch

/ 1 min read

Rename Local branch name

Terminal window
> git branch -m <old-name> <new-name>
  • if you are on that branch then no need to add <old-name>
  • -m will rename local branch name
  • verify using git branch
  • if you are on another branch then must use <old-name>

Push to Remote ( if you have pushed the local name to remote)

Terminal window
> git push -u origin :old-name <new-name>
  • Remember to put : before old-name

-u is optional; you can add it on next command

that’s all