Always Green
Any commit on the main branch should always be green. That is, I can check it out, run the full test-suite, and it comes back green.
The alternative (not all commits are green) mean that:
- Pulling an older version to compare its behavior with the newer one may mean hitting a "dud" and encountering unrelated issues.
- And thus bisecting to find which version introduced an issue may not be possible.
In a team setting, it also means that starting work on a new feature may be hampered by first having to figure out whether the latest commit is green or not.
This is what you should be getting used to. Even on private repositories, setup your CI, with linter and test-suite, and get used to have every PR scrutinized.
To branch or not to branch
Branching is orthogonal to a green main branch, and mostly a matter of team preference.
My previous team used an "live-at-head" strategy, so we would all commit to the main branch -- of course, we used CI & Pull-Request so in practice the CI created a branch, ran the tests on that, and then when approved rebased the branch on master and fast-forwarded it. That was behind the curtains, though, and was invisible.
My current team uses a one feature-one branch strategy, so the first step of starting to work on a feature/bug/ticket is to create a branch locally, then do your work there, and then once done (and green, and reviewed), merge the branch into master.
You cannot, in advance, guess which strategy your future team will use. Their strategy may also change depending on the repository and tools.
I do encourage you to become comfortable with branches; but there's no one true way.