Git Origin Master
The term “git origin master” is used in the context of a remote repository. It is used to deal with the remote repository. The term origin comes from where repository original situated and master stands for the main branch. Let’s understand both of these terms in detail.
Git Master
Master is a naming convention for Git branch. It’s a default branch of Git. After cloning a project from a remote server, the resulting local repository contains only a single local branch. This branch is called a “master” branch. It means that “master” is a repository’s “default” branch.
In most cases, the master is referred to as the main branch. Master branch is considered as the final view of the repo. Your local repository has its master branch that always up to date with the master of a remote repository.
Do not mess with the master. If you edited the master branch of a group project, your changes will affect everyone else and very quickly there will be merge conflicts.
Git Origin
In Git, The term origin is referred to the remote repository where you want to publish your commits. The default remote repository is called origin, although you can work with several remotes having a different name at the same time. It is said as an alias of the system.
The origin is a short name for the remote repository that a project was initially being cloned. It is used in place of the original repository URL. Thus, it makes referencing much easier.
Origin is just a standard convention. Although it is significant to leave this convention untouched, you could ideally rename it without losing any functionality.
In the following example, the URL parameter acts as an origin to the “clone” command for the cloned local repository:
Some commands in which the term origin and master are widely used are as follows:
- Git push origin master
- Git pull origin master
Git has two types of branches called local and remote. To use git pull and git push, you have to tell your local branch that on which branch is going to operate. So, the term origin master is used to deal with a remote repository and master branch. The term push origin master is used to push the changes to the remote repository. The term pull origin master is used to access the repository from remote to local.