Agent skill
devtools-version-control
Use when managing branches, creating and uploading CLs, or handling stacked changes in the DevTools Gerrit-based workflow.
Install this agent skill to your Project
npx add-skill https://github.com/ChromeDevTools/devtools-frontend/tree/main/.agents/skills/version-control
SKILL.md
DevTools Version Control
Overview
Chrome DevTools uses Gerrit for code review. The standard workflow is one branch per Change List (CL) and one commit per branch. Instead of multiple commits, you amend your single commit locally.
Core Workflow
Creating a New CL
To start a new task, create a new branch from main:
git new-branch <branch-name>
Note: This automatically sets the upstream to origin/main.
Making Changes
- Make your changes.
- Stage them:
git add <files>. - Create the commit:
git commit -m "Your message".
Updating a CL (Amending)
To update your CL after feedback or more work:
- Make more changes.
- Stage them:
git add <files>. - Amend the commit:
git commit --amend.
Stacked CLs
If CL B depends on CL A:
- While on branch A, create branch B:
bash
git new-branch --upstream_current <branch-B> - Develop on branch B.
- When uploading B, Gerrit will show the dependency on A.
Reparenting
If you need to change the base of a branch (e.g., move CL B to be based on main instead of CL A):
git reparent-branch main
Or to make it depend on another branch C:
git reparent-branch <branch-C>
Syncing with Upstream
To update all your branches with the latest changes from main and their respective upstreams:
git rebase-update
Initial upload
When a CL is ready, upload it with:
git cl upload -d --commit-description="<description>"
- Use the same writing style as the current committer
- Keep line length below 72
- Add a "Bug: " or "Bug: None" trailer on a separate line.
- Amend formatter/linter changes and fix linter issues.
Subsequent upload
To upload an updated CL:
git cl upload -d -t "<one sentence patch set description>"
Quick Reference
| Action | Command |
|---|---|
| Create new CL from main | git new-branch <name> |
| Create stacked CL | git new-branch --upstream_current <name> |
| Update current CL | git commit --amend |
| Upload to Gerrit | git cl upload |
| Change branch parent | git reparent-branch <new-parent> |
| Sync all branches | git rebase-update |
Common Mistakes
- Multiple commits on one branch: Gerrit expects one commit per CL. Always
commit --amend. - Using
git checkout -b: Does not set up tracking information correctly fordepot_tools. Usegit new-branch. - Manual rebasing of stacked branches: Can be complex. Use
git rebase-updateorgit reparent-branchto letdepot_toolshandle the tracking updates.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
devtools-ui-widgets
Guidelines for building UI widgets using the MVP architecture in DevTools. Covers Widget lifecycle, lit-html views, and state management.
creating-a-model
devtools-imports
Conventions for importing code in Devtools to avoid build errors. Covers cross-module imports, internal imports, and the "import * as" requirement.
devtools-module-merging
Workflow for merging a DevTools submodule into its parent module. Covers BUILD.gn consolidation and updating devtools_grd_files.gni.
verification
memory-leak-debugging
Diagnoses and resolves memory leaks in JavaScript/Node.js applications. Use when a user reports high memory usage, OOM errors, or wants to analyze heapsnapshots or run memory leak detection tools like memlab.
Didn't find tool you were looking for?