links: [[Git MOC]]
---
# How to rename a git branch
1. To rename local branch
```sh
git branch -m <old-name> <new-name>
```
2. Delete the old branch on remote
```sh
git push origin --delete <old-name>
```
Or you can shorten the process of deleting remote branch like this
```sh
git push origin :<old-name>
```
3. Push new branch to remote
```sh
git push origin -u <new-name>
```
---
tags: #git