![]() This blog post is assuming the remote is named origin if your remote has a different name then you’ll have to substitute it. Using the UI, we rename the master branch to main. How we change the default branch both remotely and locally Then I’ll dig into what the symbolic refs are and why they might not get updated automatically if one follows some other online instructions. How do I rename the remote branch to origin/legacy or origin/master I tried: git remote rename regacy legacy But this gave an error: error : Could not rename config section 'remote.regacy' to 'remote. git directory) are not accurate anymore.īelow I’ll document the steps we take when we change the default branch of a repo. 1491 I have a local branch master that points to a remote branch origin/regacy (oops, typo). We use some tools which can get confused if git’s internal files (the. Rename the local branch alpha to beta using the git rename branch command below. Instead, you will need first to rename the local branch, push the new branch to the server, and delete the old branch from your repository. Searching online will reveal a lot of articles about how to change the default branch on or changing the default branch on a local machine, but we have found that making changes to the origin can cause problems for people who don’t also make certain changes locally. You can not rename a remote branch as easily as local branches. Verify the local branch has the correct name: git branch -a 2. You will need to delete the old branch name, then push a branch with the correct name to the remote repository. GitHub has been making a similar transition on their site along with the git community. There isn’t a way to directly rename a Git branch in a remote repository. We’ve started creating all new repos with a main default branch, but there are a number of existing git repositories that still use master as their default branch name. Migrating git repos away from a “master” branch without breaking anyone’s local clones
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |