Open In App

Git – Origin Master

When we want to contribute to a git project, we need to make sure how to manage the remote repositories. One can push and pull data from a remote repository when you need to share work with teams. Origin and Master are two different terminologies used when working and managing the git projects.  

Git – Origin

Let’s see how Origin and Master are used in Git projects. Origin in simple words means from where something is originated or derived.



When cloning the remote repository to local, we use “git clone” command  and pass the URL for the remote repository as below



The “git remote” command is used to show the remotes mapped to git remote repository

Git remote -v: Shows all the remote connections linked to a git repository. It shows fetch and push operations on a remote repository as below

Git – Master

Master is the name of a default branch in git terminology. Whenever a new repository is created in git, git gives the default name to a branch as ‘Master’.

Now, let’s initialize a new git repository using the “git init” command as follows:

Now run the “Git Branch” command and check that we have a single branch in a remote repository which is ‘main‘ or ‘master‘ branch as below:

Check the Github page and see that there is the only branch, i.e the main branch as below depicted as follows:

Origin/Main in Git Terminology

Since Origin and Master are two different terminologies in Git but we might get confused when we see Origin/master in git context

Since origin/master is a branch. Below is the process to merge the origin/master to master branch on remote origin

Step 1: Fetch the remote branch ‘master’ from remote ‘origin’. Master branch would be fetched to local and local copy would be called as origin/master

git fetch origin master

Step 2: Then merge the ‘origin/master’ to ‘master’

git merge origin/master

Step 3: Finally, now push the changes from remote branch ‘master’ to remote ‘origin’

git push origin master
Article Tags :