Xavi Smith

Experienced Professional | Transitioning from Tech to Education

How to Rename Your Git Branch

I have to look this up so frequently that I decided 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 commit (haha!) this to memory, I’ve decided to add the following alias to my dotfiles:

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

Then I can use the alias in my terminal like this:

gbr new-branch-name

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *