Git branching (workflows)
In short: A branch is a separate line of development in Git. Workflows define how teams use and merge branches.
In more detail: In trunk-based development everyone works on main with small, frequent changes and feature flags. In the feature-branch workflow each task gets a branch that is reviewed via pull request and merged into main. Git Flow additionally uses develop, release and hotfix branches.
In Depth
- Pull request: proposal for merging with review, tests and discussion.
- Squash merge: All commits of a branch become one. History stays tidy.
- Rebase vs. merge: Rebase rewrites history (not on shared branches), merge preserves it.
- Commit messages: short, imperative, “Fix error on login”.
- Protection: protected
mainbranch, mandatory reviews, green tests.
See also: Merge conflicts, Semantic versioning