Main Branch: The primary branch of a repository, holding the stable, accepted code. It is usually named main; older projects use master.

Example

Your team's main branch is protected: nobody can push to it directly. Your change reaches main only after your pull request is approved and the automated tests pass.

Why the Main Branch Matters

  • It is the source for releases and deployments in many teams.
  • Everyone starts new branches from it.
  • If main is broken, the whole team is blocked.

Branch Protection Rules

RuleWhat it means
No direct pushesChanges must come through a pull request
Required reviewsAt least one or two approvals before merging
Required checksCI tests must pass first
Up-to-date branchYour branch must include the latest main before merging

Main vs Master

Git and GitHub used master as the default name for years. Since around 2020, most new repositories use main. They work the same way; check which one your project uses.

Related terms

Previous term: Machine Learning (ML)  |  Next term: Manual Testing

Related guides

Frequently asked questions

What is the main branch in Git?

The main branch is the primary branch of a repository that holds the stable, accepted code.

What is the difference between main and master?

Only the name. master was the old default; most new repositories use main.

Can I push directly to main?

In most team projects, no. Changes go through pull requests with reviews and automated checks.

Why is my push to main rejected?

The branch is probably protected. Create a branch, push it, and open a pull request instead.

Explore more internship terms

The IT Internship Glossary explains 199 terms you will hear before and during your internship, with simple definitions and real examples.

Browse all 199 terms
Dhaivat Ajwaliya

About the author

Dhaivat Ajwaliya

Dhaivat has 16+ years of experience in the IT industry, working on AI and cloud technologies, project delivery, and engineering leadership. He has interviewed and mentored many interns, wrote The Lost Intern, and runs the non-commercial Career Impact Initiative, mentoring students for free.