TL;DR version

git branch -m old-branch new-branch

Long version

If you have two branches, master and old-branch, and you’re on master branch. If you wanna replace the name of the branch old-branch with new-branch, type this in your terminal:

git branch -m old-branch new-branch

If you’re on old-branch branch already, enter this:

git branch -m new-branch