Implementation:SeleniumHQ Selenium Git Fork And Branch Pattern
| Knowledge Sources | |
|---|---|
| Domains | Version_Control, Developer_Experience, Collaboration |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
External tool documentation for the Git fork-and-branch workflow used by Selenium contributors.
Description
Contributors fork the Selenium repo on GitHub, clone with --depth 1 for speed (the repository exceeds 2GB), add the upstream remote using the git:// protocol, and create feature branches. The project practices HEAD-based development, meaning all changes are applied directly on top of trunk. Contributors synchronize with git rebase (not git merge). Commits follow the convention: approximately 50-character first line, blank line, 72-column wrapped body, with Fixes #N references. After review, PRs are squash-rebased by a committer to maintain a linear trunk history.
Dependencies bundled in third_party/ should not be modified locally; changes to those files must be sent upstream. New dependencies should be discussed with committers on the IRC channel or mailing list before implementation.
Usage
Execute these git commands when starting a new contribution. Use shallow clone for faster initial setup. Apply changes in fixup commits during review, which will be squashed at merge time.
Code Reference
Source Location
- Repository: Selenium
- File: CONTRIBUTING.md (L50-315)
Signature
# Step 1: Fork and clone
git clone git@github.com:YOUR_USER/selenium.git --depth 1
cd selenium
git remote add upstream git://github.com/seleniumhq/selenium.git
# Step 2: Create feature branch
git checkout -b my-feature-branch
# Step 3: Configure git identity
git config --global user.name 'Your Name'
git config --global user.email 'you@example.com'
# Step 3: Make changes and commit
git add <files>
git commit -m "Short summary (~50 chars)
Detailed description wrapped at 72 columns.
Explain what changed and why.
Fixes #1234"
# Step 4: Rebase (not merge) to sync
git fetch upstream
git rebase upstream/trunk
# Step 5: Push and create PR
git push origin my-feature-branch
Import
N/A - Git CLI commands
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| GitHub fork URL | URL | Yes | Your forked repository URL |
| Branch name | String | Yes | Descriptive feature branch name |
Outputs
| Name | Type | Description |
|---|---|---|
| Feature branch | Git branch | Local branch ready for changes, rebased on upstream/trunk |
Usage Examples
Complete Workflow
# Fork on GitHub, then clone
git clone git@github.com:myuser/selenium.git --depth 1
cd selenium
git remote add upstream git://github.com/seleniumhq/selenium.git
# Create feature branch
git checkout -b fix-chrome-options
# Make changes, then commit
git add java/src/org/openqa/selenium/chrome/ChromeOptions.java
git commit -m "Fix ChromeOptions merge behavior
The merge method was not properly handling encoded extensions
when merging two ChromeOptions instances.
Fixes #12345"
# Sync before pushing
git fetch upstream
git rebase upstream/trunk
# Push and create PR
git push origin fix-chrome-options
# Then use GitHub UI "Compare & pull request" or gh pr create
Addressing Review Comments
# Apply review feedback as fixup commits
git add <changed-files>
git commit --fixup=HEAD
git push origin fix-chrome-options
# Committer will squash all commits at merge time