Files
30-seconds-of-code/snippets/rename-branch.md
2021-04-08 20:32:07 +03:00

19 lines
308 B
Markdown

---
title: Rename a branch
tags: branch,intermediate
---
Renames a local branch.
- Use `git branch -m <old-name> <new-name>` to rename `<old-name>` to `<new-name>`.
```sh
git branch -m <old-name> <new-name>
```
```sh
git checkout master
git branch -m patch-1 patch-2
# Renames `patch-1` to `patch-2`
```