Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is "master" a standard branch name in git, or is it just the standard practice?

I noticed the names "master" and "origin" being used a lot in git. What's the difference between these, and are either standard in git, or are they just common practice? Which would be the root folder of the repository?

like image 535
Marty Avatar asked Jan 21 '12 06:01

Marty


People also ask

Is master the default branch?

Default is ' master '. Note that this must be a local branch name like 'master' or 'develop'.

Is master a branch in Git?

The default branch name in Git is master . As you start making commits, you're given a master branch that points to the last commit you made. Every time you commit, the master branch pointer moves forward automatically. The “master” branch in Git is not a special branch.

Why is Git branch named master?

Historically, the default name for this initial branch was master . This term came from Bitkeeper, a predecessor to Git. Bitkeeper referred to the source of truth as the "master repository" and other copies as "slave repositories".

Is master branch compulsory in Git?

No, the main branch can be any branch you want. By default, when you create a repository, the main branch is named the master branch. It is the base branch or the default branch. You can go through How to set up default branches in Git to know more.


1 Answers

master is the default branch that is created in Git when you create a repo. It is pretty standard, but you may have a repo without master branch. You can delete or rename it, but it is generally not advised.

origin is the remote from which you clone from and is set up by git. It is also pretty standard, but you may delete it or rename it or add a remote origin without cloning.

Note that all repos created in git come with master. But only cloned ones come with origin.

like image 67
manojlds Avatar answered Oct 14 '22 21:10

manojlds