Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

10
  • 11
    Or git branch -m other-branch renamed-other-branch if you're not. Commented Oct 5, 2010 at 19:27
  • 33
    Also, if you've pushed the old branch to a remote, you can delete it with git push origin :branchname. That would allow you to push the new one and delete the old one, essentially renaming it on the remote. Commented Oct 7, 2010 at 14:52
  • 1
    @mipadi, it creates the new branch and don't delete the previous one. Commented Aug 3, 2015 at 9:17
  • git branch (-m | -M) [<oldbranch>] <newbranch> Didn't work for me, giving the syntax error. Commented Aug 3, 2015 at 9:18
  • @MohammedArif With -m, it renames the old branch, so it does delete the previous one. Commented Aug 3, 2015 at 9:35