GIT ORIGIN MASTER
- The term "git origin master" is used in the context of interacting with a remote repository.
- "Origin" refers to the original location where the repository is hosted, while "master" represents the main branch of the repository. Let's take a closer look at both terms.
Git Master
- "Master" is the default naming convention for a Git branch. After cloning a project from a remote server, the local repository contains only one branch, called the "master" branch. This means that "master" serves as the repository's default branch.
- In most cases, the master branch is referred to as the main branch and is considered the final version of the repository.
- Your local repository contains a master branch that is always kept up-to-date with the master branch of the remote repository.
- Avoid making changes directly to the master branch. Editing the master branch in a group project can impact everyone else and quickly lead to merge conflicts.
Git Origin
- In Git, the term "origin" refers to the default remote repository where you publish your commits. While "origin" is the default name, you can work with multiple remote repositories, each with a different name. It acts as an alias within the system.
- "Origin" is a shorthand for the remote repository from which a project was originally cloned. It replaces the repository's URL, making it easier to reference.
- In the example below, the URL parameter serves as the origin for the "clone" command, linking it to the cloned local repository:
Syntax
$ git clone https://github.com/ImDwivedi1/Git-Example
Here are some commands in which the terms "origin" and "master" are commonly used:
- Git push origin master
- Git pull origin master
Git has two types of branches: local and remote. To use the 'git pull' and 'git push' commands, you need to specify which branch your local branch will operate on. The term "origin master" refers to interacting with the remote repository and the master branch. The command 'git push origin master' is used to push changes to the remote repository, while 'git pull origin master' is used to retrieve updates from the remote repository to your local branch.