Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

move a branch path in git (change its name, not its code) [duplicate]

Tags:

git

renaming

we have a branch on remote called release/service-release-2016

I want to rename the branch to release/completed/service-release-2016 for archiving and clarity.

How do I do this?

Everything I searched for interpreted this as moving around commits and the head, etc. - I'm thinking this is probably pretty easy.

like image 535
Oliver Williams Avatar asked Oct 31 '22 01:10

Oliver Williams


1 Answers

One way to do this would be to check out the remote branch to a temporary branch name locally, push to the new name on the remote, and then delete the remote branch. For example:

git checkout -b tmp origin/release/service-release-2016

Create the new remote branch:

git push origin tmp:release/completed/service-release-2016

Delete the old remote branch:

git push origin :release/service-release-2016
like image 185
jholtrop Avatar answered Nov 10 '22 08:11

jholtrop