This will rename the remote branch to new-branch-name and set it to track the local new-branch-name branch. Alternatively, you can use a single command. Rename the branch by entering the command: git branch -m new-name. You should receive confirmation that the branch is checked out. Hence, keep the new one and delete the old branch from the remote repository. Enter the name of the branch you want to change in your command-line interface: git checkout old-branch. Letâs say the remote repository name is XYZ and you want to push the locally renamed branch to it git push -u xyz new-Linux-h2sĪfter that, you will see both new and old branches in your remote repository. However, here we are actually pushing the locally renamed branch to the remote repository and then deleting the old branch from there. Whereas, for those who are interested in renaming the remote GIT branch as well on the remote repository then instead of the git branch command and -m option we will use the git push command with the -u option to update the remote branch. Running the above command syntax with your actual GIT branch name will only rename the branch available on your local system and does not affect the branch on the remote repository. git branch -m old-Linux-h2s new-Linux-h2s Now, the command syntax for this will be. We can use this command to rename the branch in case we have named it wrongly or just want to change it for some other project.įor example, your old git branch name is old-Linux-h2s and now you want to change it to some new name letâs say new-Linux-h2s. This behavior may be changed via the global toSetupMerge configuration flag. It is easily possible to rename the existing local branch of GIT using the command- git branch and option -m on our system. When a local branch is started off a remote-tracking branch, Git sets up the branch (specifically the branch..remote and branch..merge configuration entries) so that git pull will appropriately merge from the remote-tracking branch.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |