git rename remote branch

# Rename the local branch to the new name
git branch -m <old_name> <new_name>

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

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

# Push the new branch to remote
git push <remote> <new_name>

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

3.6
10
Noway 80 points

                                    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 &ndash;&ndash;delete old-name

3. Finally, push the branch with the correct name, and reset the upstream branch:
git push origin &ndash;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 &ndash;u new-name

3.6 (10 Votes)
0
0
0

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

0
0
4.17
6
Tomasz74 90 points

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

4.17 (6 Votes)
0
5
3
NRW 125 points

                                    git push origin :&lt;branch_to_rename&gt;
git checkout -b &lt;new_branch_name&gt;
git push --set-upstream origin &lt;new_branch_name&gt;

5 (3 Votes)
0
3.5
4

                                    git push origin :&lt;branch_to_rename&gt;
git checkout -b &lt;new_branch_name&gt;
git push --set-upstream origin &lt;new_branch_name&gt;

3.5 (4 Votes)
0
3.33
3

                                    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 &ndash;&ndash;delete old-name

3. Finally, push the branch with the correct name, and reset the upstream branch:
git push origin &ndash;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 &ndash;u new-name

3.33 (3 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
git change branch name remote change remote branch name git rename branche origin rename remote git branch git change remote branch name chage branch name rename git branch remote change branch name in remote change name of git branch chnage branch name git rename origin branch git git rename branch delete remote rename branch git remote update branch name change current branch remote how change branch name change local branch name how to change branch name git how to change branch name change a branch name rename branch git remote and local git branch change remote name rename a remote branch git rename a git branch remote rename remote master branch github git change name of branch branch name change command git change local branch name git change name branch rename branch name as remote rename branch in git remote change branch name git local rename branch origin git how to rename origin branch rename remote branch github rename branch git update branch name git rename remote and local branch git change local and remote branch name how to rename a remote branch in git git rename branch on remote and local how to rename brance in remote and local how to change remote branch name change branch name remote change name of a remote branch change remote branch name git git branch rename remote and local how rename remote branch git how to change a branch name does rename branch local remote how to rename remote branch git how to change remote branch name in git git rename branch remote git branch rename origin git how to rename a remote branch git rename local and remote branch how to rename remote branch git rename a branch remote how to change branch name in git git branch rename remote chnge branch name rename a remote branch change branch name in git rename branch remote edit branch name git change branch name on remote change git branch name how to change origin branch name in git git rename origin branch rename branch local and remote how to rename local and remote branch in git how to change branch name in git local and remote rename git branch remote and local change bran name git rename branch git origin rename origin branch rename git remove old branch renaming a branch in github how to change branch name locally and remotely how to change the name of a branch on git git rename branch name how to change github branch name git how to change the name of a branch in remote branch how to rename branch from the terminal change name of branch git how to rename a branch in github rename remote branch in git how to rename remote branch name in git how to rename remote git branch git how to change branch name rename branch in git rename gut branch git rename upstream branch push force git after rename branch change branch name local and remote how to rename branch in git push rename branch github change name of remot branch rename remote branch git rename remote branch git rename orgin branch goit rename remote branch how to change git remote branch name change name of brach local and remote git rename branch in remote Git remote branch name change git rename a branch change the name of the branch git change name of branch in git git how to change remote branch name change branch name in git local and remote how to rename branch locally and remotely change name of the branch git rename a remote branch in git how to change the name of a branch in git rename local branch how to change a branch name in git how to rename brtanch how to rename a branch in git bash how to rename branch rename branch how to push a renamed branch in github git branch name edit to rename local and remote branches in git renmae branch git renaming a branch in git how to update a branch name in git git branch rename command git rename remote branch git branch rename git rename remote branch name github rename a branch rename branches git cli change local branch name in git how to rename branch git github rename remote branch git rename branch name local rename a remote git branch change the name of a branch git git rename branch change name branch git git rename branch local and remote how to change current branch name in git git push rename branch how to rename git branch rename local and remote branch git change the name of branch git change branch name change branch name git how to rename a git branch locally and remotely git branch name change rename git branch local and remote renme git branch rename git branch how to rename a branch in git rename a branch git git rename branch git git change branch name command line git change branch name how to change git branch name renaming local branch git how to change the name of a git btranch rename branch locally git git rename local branch
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source