Skip to content

Commit

Permalink
docs: quick tutorial how to rename local and remote git branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsanima committed May 2, 2022
1 parent 74a42bf commit efef3d4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
39 changes: 39 additions & 0 deletions docs/tutorials/how-to-rename-local-and-remote-git-branch.md
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.
1 change: 1 addition & 0 deletions docs/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Here we will post interesting quick tutorials that may be useful to you.
how-to-install-python-on-ubuntu-linux-system
how-to-remove-trash-icon-from-ubuntu-desktop
how-to-rename-local-and-remote-git-branch
```

0 comments on commit efef3d4

Please sign in to comment.