How do I rename a local Git branch?

Summary

git branch -m <oldname> <newname>  # From any branch
git branch -m <newname>            # From current branch

Details

Renaming Any Other Branch

  1. If you want to rename a branch while pointed to any branch, do:
git branch -m <oldname> <newname>

Renaming Current Branch

  1. If you want to rename the current branch, you can do:
git branch -m <newname>

Documentation