-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: quick tutorial how to rename local and remote git branch
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
docs/tutorials/how-to-rename-local-and-remote-git-branch.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# {octicon}`telescope;1em;sd-text-secondary` `HOW TO RENAME LOCAL AND REMOTE GIT BRANCH` | ||
|
||
When you want rename local and remote Git branches you can do very easily | ||
using the `git branch -m` command on you terminal. | ||
|
||
This quick tutorial explains how to rename local and remote Git branches. You | ||
only need to push the renamed local branch and delete the branch with the old | ||
name. | ||
|
||
## RENAMING `GIT BRANCH` | ||
|
||
First step is a switching to the local branch wchich you want to rename, simply | ||
type in the terminal: | ||
|
||
```shell | ||
git checkout <old-branch-name> | ||
``` | ||
|
||
Next step is a rename the local branch, type in the terminal: | ||
|
||
```shell | ||
git branch -m <new-branch-name> | ||
``` | ||
|
||
Push the local `<new-branch-name>` to the remote repository and reset the | ||
upstream branch by typing in the terminal: | ||
|
||
```shell | ||
git push origin -u <new-branch-name> | ||
``` | ||
|
||
Finnaly you can delete the remote `<old-branch-name>` by typing in the | ||
termianl: | ||
|
||
```shell | ||
git push origin --delete <old-branch-name> | ||
``` | ||
|
||
You have saccessfully renamed the local and remnote Git branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters