Git: rename a branch
If you’re currently on that branch you can rename it using:
git branch -m my-new-name
Otherwise if you’re not on that branch use:
git branch -m old-name my-new-name
If you like bash/zsh aliases you can make it so the name you pass in is dynamic and make a generic command for renaming a branch:
alias grm="git branch -m $1"
If you like bash/zsh aliases you can make it so the name you pass in is dynamic. Read more about git branch flags here. Read more about bash aliases here.