How to Rename Your Git Branch

I have to look this up so fre­quent­ly that I decid­ed to write my own blog post to remind myself. Here’s how to rename a git branch.

git branch -m new-branch-name

Since I can’t seem to com­mit (haha!) this to mem­o­ry, I’ve decid­ed to add the fol­low­ing alias to my dot­files:

# ~/.dotfiles/git/aliases.zsh
alias gbr="git branch -m"

Then I can use the alias in my ter­mi­nal like this:

gbr new-branch-name