Add rename branch snippets
This commit is contained in:
18
snippets/rename-branch.md
Normal file
18
snippets/rename-branch.md
Normal 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`
|
||||
```
|
||||
Reference in New Issue
Block a user