Principle:SeleniumHQ Selenium Git Branching Strategy
| Knowledge Sources | |
|---|---|
| Domains | Version_Control, Developer_Experience, Collaboration |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
Git workflow for Selenium contributors using fork-based development with feature branches based on the upstream trunk branch.
Description
Selenium uses a fork-and-branch workflow where contributors fork the repository on GitHub, clone with --depth 1 for performance (the repository is over 2GB), add the upstream remote, create feature branches, make changes, and submit pull requests. The trunk branch is the single default branch; the project practices HEAD-based development where all changes are applied directly on top of trunk. PRs are squash-merged, meaning each PR becomes a single commit on trunk to maintain a linear history. Contributors use git rebase (not git merge) to synchronize with upstream. Commit messages follow a specific convention: a 50-character first line, a blank second line, and a body wrapped at 72 columns, with Fixes #N references to link to issues.
Usage
Follow this workflow for all contributions. Create a new branch for each feature or fix. Never commit directly to trunk in your fork. Use git rebase upstream/trunk to stay in sync rather than merging.
Theoretical Basis
# Git Workflow Steps
1. Fork: GitHub UI -> Fork SeleniumHQ/selenium
2. Clone: git clone git@github.com:USER/selenium.git --depth 1
3. Add upstream: git remote add upstream git://github.com/seleniumhq/selenium.git
4. Branch: git checkout -b feature-name
5. Commit: git commit (50-char summary, blank line, 72-col body, "Fixes #N")
6. Sync: git fetch upstream && git rebase upstream/trunk
7. Push: git push origin feature-name
8. PR: GitHub UI or gh pr create (squash-merged to trunk)
# Commit Message Format
Line 1: Short description (~50 chars)
Line 2: (blank)
Line 3+: Detailed explanation wrapped at 72 columns.
Reference issues: Fixes #1234
# Key Principles
- HEAD-based development (all changes on top of trunk)
- Rebase, never merge
- Squash merge into trunk (linear history)
- Shallow clone (--depth 1) for speed