Friday, January 15, 2021

Rename remote and local git branch

We can rename any remote and local git branch  using following steps:

1. Checkout the branch that you want to rename

git checkout <existing branch name>

2. Rename the above checked out branch in your local
git branch -m <new branch name>

3. Push the branch with new changed name

git push origin -u <new branch name>

4. Remotely branch with old name also exist, which you can delete
git push origin --delete <old branch name>

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home