top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How to rename branch in git on local and remote server?

+1 vote
46 views
How to rename branch in git on local and remote server?
posted Nov 24, 2016 by Amit Kumar Pandey

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+2 votes

Local Server

If you want to rename a branch while pointed to any branch, do :

git branch -m <oldname> <newname>

If you want to rename the current branch, you can do:

git branch -m <newname>

Delete the oldname remote branch and push the newname local branch.

git push origin :oldname newname

Reset the upstream branch for the newname local branch.
Switch to the branch and then:

git push origin -u newname
answer Nov 24, 2016 by Salil Agrawal
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...