mirror of
https://github.com/jbranchaud/til
synced 2026-01-05 08:08:02 +00:00
Add Renaming A Branch as a git til.
This commit is contained in:
@@ -39,6 +39,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
- [Last Commit A File Appeared In](git/last-commit-a-file-appeared-in.md)
|
- [Last Commit A File Appeared In](git/last-commit-a-file-appeared-in.md)
|
||||||
- [List Filenames Without The Diffs](git/list-filenames-without-the-diffs.md)
|
- [List Filenames Without The Diffs](git/list-filenames-without-the-diffs.md)
|
||||||
- [List Untracked Files](git/list-untracked-files.md)
|
- [List Untracked Files](git/list-untracked-files.md)
|
||||||
|
- [Renaming A Branch](git/renaming-a-branch.md)
|
||||||
- [Single Key Presses in Interactive Mode](git/single-key-presses-in-interactive-mode.md)
|
- [Single Key Presses in Interactive Mode](git/single-key-presses-in-interactive-mode.md)
|
||||||
- [Staging Changes Within Vim](git/staging-changes-within-vim.md)
|
- [Staging Changes Within Vim](git/staging-changes-within-vim.md)
|
||||||
- [Staging Stashes Interactively](git/staging-stashes-interactively.md)
|
- [Staging Stashes Interactively](git/staging-stashes-interactively.md)
|
||||||
|
|||||||
16
git/renaming-a-branch.md
Normal file
16
git/renaming-a-branch.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Renaming A Branch
|
||||||
|
|
||||||
|
The `-m` flag can be used with `git branch` to move/rename an existing
|
||||||
|
branch. If you are already on the branch that you want to rename, all you
|
||||||
|
need to do is provide the new branch name.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git branch -m <new-branch-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to rename a branch other than the one you are currently on, you
|
||||||
|
must specify both the existing (old) branch name and the new branch name.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git branch -m <old-branch-name> <new-branch-name>
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user