Branching Strategies
A branching strategy defines how a team organizes branches, such as when to create them and how they get merged. Common strategies include Git Flow, GitHub Flow, and trunk-based development.
Choosing a consistent strategy helps teams avoid confusion about where to start new work and how releases are managed, especially as a project and team grow.
git switch -c feature/short-lived-task
# work, commit, push, open PR, merge, delete branchGitHub Flow
GitHub Flow is simple: main is always deployable, new work happens on short-lived feature branches, and every change goes through a pull request before merging into main.
Git Flow and trunk-based development
Git Flow uses separate develop, feature, release, and hotfix branches for more structured releases. Trunk-based development has everyone commit small, frequent changes directly to main or very short-lived branches.
git switch -c feature/add-search
# ...make changes...
git push -u origin feature/add-searchBranch 'feature/add-search' set up to track remote branch.Follows GitHub Flow by creating a short-lived branch for one feature, ready for a pull request.
git branch -d feature/add-searchDeleted branch feature/add-search (was 7f3c2ee).Deletes the local feature branch after it has been merged, keeping the branch list clean.
Key points
- A branching strategy defines how a team creates and merges branches.
- GitHub Flow uses short-lived feature branches merged via pull requests.
- Git Flow adds structured develop, release, and hotfix branches.
- Trunk-based development favors small, frequent commits to main.
