Optionally, run the following command to remove tracking references to the old branch name. Git branch -u origin/NEW-BRANCH-NAME NEW-BRANCH-NAME git branch -m OLD-BRANCH-NAME NEW-BRANCH-NAME Updating a local clone after a branch name changesĪfter you rename a branch in a repository on GitHub, any collaborator with a local clone of the repository will need to update the clone.įrom the local clone of the repository on a computer, run the following commands to update the name of the default branch. Review the information about local environments, then click Rename branch. nothing to commit, working tree clean Step 4. git branch -m master main git status On branch main Your branch is up to date with 'origin/master'. Notice that remotely, our local main branch is still tracking the remote master. Next to the branch you want to rename, click. In this step, we are simply changing, locally, the name of master to main. You can also find the branch dropdown menu at the top of the integrated file editor. On, navigate to the main page of the repository.įrom the file tree view on the left, select the branch dropdown menu, then click View all branches. You should consider adding a new branch with the original content plus an additional commit reporting that the branch name is deprecated and suggesting that users migrate to the new branch name. ![]() GitHub Actions workflows do not follow renames, so if your repository publishes an action, anyone using that action with will break. Also, GitHub does not perform any redirects if users perform a git pull for the previous branch name. If the renamed branch is the head branch of an open pull request, this pull request is closed.Īfter the rename is complete, GitHub provides instructions on the repository's home page directing contributors to update their local Git environments.Īlthough file URLs are automatically redirected, raw file URLs are not redirected. Branch protection policies are also updated, as well as the base branch for open pull requests (including those for forks) and draft releases. When you rename a branch on, any URLs that contain the old branch name are automatically redirected to the equivalent URL for the renamed branch. ![]() For more information about branches, see " About branches)." You can rename a branch in a repository on.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |