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
| Rule | What it means |
|---|---|
| No direct pushes | Changes must come through a pull request |
| Required reviews | At least one or two approvals before merging |
| Required checks | CI tests must pass first |
| Up-to-date branch | Your 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
- Branch: main is the primary branch.
- Feature Branch: where work happens before reaching main.
- Merge: how changes reach main.
- Continuous Integration (CI): checks changes before they reach main.
Previous term: Machine Learning (ML) | Next term: Manual Testing
Related guides
- What to Do in Your First Week of an IT Internship
- Build a GitHub Portfolio That Gets You Internship Interviews
- DevOps Interview Questions Test
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