Add rename branch snippets

This commit is contained in:
Isabelle Viktoria Maciohsek
2021-04-05 09:48:16 +03:00
parent dbad3a6995
commit aa8ddd1312
2 changed files with 44 additions and 0 deletions

18
snippets/rename-branch.md Normal file
View File

@ -0,0 +1,18 @@
---
title: Rename a branch
tags: branch,beginner
---
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`
```