![]() The next step is to delete the master branch on GitHub. Now that we have a main branch on our local computer, a main branch up on GitHub, and the default branch on GitHub is the main branch. Nice job! One more step to get, we just need to get rid of the master branch so that the main branch is the only branch. Next, click the arrows to change the default branchĪfter the default branch change, you can go back to the main repo page and see that main is now the default branch. Then on the lefthand menu, click on branches does the right thing: setting the master to its origin state. On the main page for your repo, click on settings. git checkout master git reset -hard origin/master. We are going to change it so the default repo and the checkmark are next to the main branch. If you go to the main repo page on GitHub and select the branches dropdown menu, you will see two branches listed and a checkmark next to master. You need to do this on GitHub, not on your local computer. You can see which branch you are on using the command below:Ĭhange the default branch on GitHub to main The first step is to create a new branch locally (on your computer) called main. Step 1Ĭreate a new main branch locally, taking the history from master So change all of your GitHub repo names to main. This is confusing and leads to creating new branches that you don't want. Is the master branch in charge of anything? Are other branches subservient to it? And a very practical reason is that since GitHub moved to use main as the default branch, you have to remember when to use git push origin main and when to use git push origin master on a repo-to-repo basis. In addition, the name main just makes more sense. Language in programming, like master, that supports symbols of racism has no place. The reason to use the name main as the default branch on Github and in your local git repos is that it's the right thing to do. Although it is significant to leave this convention untouched, you could ideally rename it without losing any functionality.Git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main It is used in place of the original repository URL. The origin is a short name for the remote repository that a project was initially being cloned. The default remote repository is called origin, although you can work with several remotes having a different name at the same time. ![]() In Git, The term origin is referred to the remote repository where you want to publish your commits. If you edited the master branch of a group project, your changes will affect everyone else and very quickly there will be merge conflicts. Your local repository has its master branch that always up to date with the master of a remote repository.ĭo not mess with the master. Master branch is considered as the final view of the repo. In most cases, the master is referred to as the main branch. It means that "master" is a repository's "default" branch. After cloning a project from a remote server, the resulting local repository contains only a single local branch. ![]() Master is a naming convention for Git branch. Let's understand both of these terms in detail. The term origin comes from where repository original situated and master stands for the main branch. It is used to deal with the remote repository. The term "git origin master" is used in the context of a remote repository.
0 Comments
Leave a Reply. |