![]() Otherwise user has to be the owner of the repo or collaborator with appropriate permission to perform the branch renaming. Renaming of branch can be done by Git Admins. This blog captures the steps to rename the branch and change the default branch name to new renamed branch. Follow the steps below to rename a Local and Remote Git Branch: Start by switching to the local branch which you want to rename: git checkout Rename the local branch by typing: git branch -m At this point, you have renamed the local branch.So recently I've renamed one of my repo's default branch from master to main. Step-4: Reset the upstream branch for the new-name local branch. Step-3: Delete the old-name remote branch and push the new-name local branch. Steps to rename the other users local repoĪs part of adopting the Open Source Inclusive Naming Initiative, it is recommended to change the default branch name from master to main in Source Code Management tools. Scenario-2: When remote branch is not cloned locally.Step 4 Finally delete the master branch from remote.You just need to create a new branch and make it start at the point v1/master currently is. Step 3 Swap default branch setting in Github UI Their local branches will continue to point to the same remote tracking branches (same name).Step 2 Rename the branch master to main in remote.To ensure that the rename was successful, retrieve the current status of the branch using the git branch -a command. Now enter the following command if you want to rename a Git branch: git branch -m old-name new-name. Step 1 Rename master to main in local repo To do this, use the following steps: Switch to the master via the command git checkout master.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |