rename a git branch 1

rename a git branch

# Rename the local branch to the new name
git branch -m  

# Delete the old branch on remote - where  is, for example, origin
git push  --delete 

# Or shorter way to delete remote branch [:]
git push  :

# Push the new branch to remote
git push  

# Reset the upstream branch for the new_name local branch
git push  -u 

Here is what the above code is Doing:
1. Rename the local branch to the new name
2. Delete the old branch on remote
3. Push the new branch to remote
4. Reset the upstream branch for the new_name local branch

Similar Posts