Git Rename Branch-Git Rename Remote branch

0 Comment

Git Rename Branch-Git Rename Remote branch

whatever the procedure we are using for git rename branch, we use the same procedure for bitbucket and gitlab. in the following steps i will show you how to git rename remote branch and how to git rename local branch. so now you can use below commands in all cases like git bitbucket, gitlab.

Git Rename Local Branch-If It Is A Current Branch:

So to git rename local branch use this below command

Git Rename Local Branch-If It Is Another Branch:

Now by using the above command, you have changed the branch name in local.  So now you have to change this name in the remote.
for that, you need to follow three steps. with these three steps you can do git rename remote branch.

Git Rename Remote Branch

  • pull your changes
  • delete the old branch in remote
  • push your newly renamed branch and track that new branch with local

Before deleting your old branch in remote make sure that you have the latest version of the code in local from the remote. Or make sure that you are in sync with the remote branch for that you need to pull the changes.
If you delete the old branch without pulling you may loose newly changes done by any developers.
So first check out to your new named branch.

Now pull your changes

Now you have all the files
Now you can delete the old branch from the remote.

Delete The Old Branch In Remote:

here you are deleting the old branch from the remote and no need to fear that you are deleting a branch since already you have that branch in locally with a different name. just you need to push our locally renamed new branch.

Push New Branch and Track With Remote

it will push your newly renamed branch and all your files to remote. and both remote and local will be in track. now we have completed the git remote branch

now we have successfully done the git rename branch in remote and local.

 

  • git rename branch
  • git rename local branch
  • git rename remote branch name
  • bitbucket rename branch name
  • git rename a branch
  • bitbucket rename remote branch name
  • git rename remote branch without deleting
  • rename remote branch gitlab
  • git rename branch local and remote
  • rename branch remote and local git
  • how to rename branch name in git
  • how to rename branch name in bitbucket
[top]

Leave a Reply

Your email address will not be published. Required fields are marked *