Shell/Bash: git rename remote branch Example


Shell/Bash Example: This is the "git rename remote branch" Example. compiled from many sources on the internet by

git rename remote 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 

Git change remote branch name

1. Verify the local branch has the correct name:
git branch -a

2. Next, delete the branch with the old name on the remote repository:
git push origin ––delete old-name

3. Finally, push the branch with the correct name, and reset the upstream branch:
git push origin –u new-name

Alternatively, you can overwrite the remote branch with a single command:
git push origin :old-name new-name
Resetting the upstream branch is still required:
git push origin –u new-name

git rename remote

git remote rename old-remote-name new-remote-name

edit branch name git

$ git checkout Branch-Name-You-Want-to-Change
$ git branch -m New-Branch-Name

change local branch name

git branch -m 

git change branch name

git branch –m old-name new-name

* Summary: This "git rename remote branch" Shell/Bash Example is compiled from the internet. If you have any questions, please leave a comment. Thank you!