Version control

From ChromeDevTools/devtools-frontend · View interactive version

Version control is an AI agent skill from the GitHub repository ChromeDevTools/devtools-frontend. Use when starting a new task, creating a branch, switching branches, managing branches, creating and uploading CLs, handling stacked changes, or checking release and roll status in the DevTools Gerrit-based workflow. ALWAYS use this instead of running standard git checkout/switch commands for branch

How to use this skill

Skill file

DevTools Version Control

[!IMPORTANT]

DO NOT use standard Git commands like git checkout -b or git switch -c to create branches.

In Chrome DevTools, you MUST always use git new-branch <branch-name> (or git new-branch --upstream_current <branch-name> for stacked CLs). Standard commands fail to configure the correct upstream tracking branch required by depot_tools and Gerrit.

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

  1. Make your changes (keeping each CL <= 350 lines of insertions + deletions, with 100% of new code called in production and tested in the same CL).
  2. Stage them: git add <files>.
  3. Create the commit: git commit -m "Your message".

```bash

git config --global cl.upload-conversation-id true

```

Updating a CL (Amending)

To update your CL after feedback or more work:

  1. Make more changes.
  2. Stage them: git add <files>.
  3. Amend the commit: git commit --amend.

Stacked CLs

If CL B depends on CL A:

  1. While on branch A, create branch B:

```bash

git new-branch --upstream_current <branch-B>

```

  1. Develop on branch B.
  2. When uploading B, Gerrit will show the dependency on A.

Reparenting & Detaching Landed CLs

If you need to change the base of a branch back to the root branch (e.g., move CL B to be based on origin/main instead of CL A):

git reparent-branch --root

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, and synchronize dependencies:

git rebase-update && gclient sync -Df

Uploading & Requesting Review

Always run ChromiumCodeReviewAgent on a Work-in-Progress (WIP) CL and resolve any ERROR or WARNING findings before marking the CL Ready for Review or adding human reviewers.

Step 1 — Upload as WIP and trigger AI review

Upload with -o wip and without --send-mail (-s) (and without -c / --use-commit-queue, which implies --send-mail) so Gerrit creates the CL in Work-in-Progress even when work_in_progress_by_default is disabled, reuse the local commit message with --commit-description=+, and trigger a CQ dry run (--cq-dry-run / -d) before adding human reviewers to the attention set:

git cl upload -f --cq-dry-run -o wip --commit-description=+

Or, if the WIP patchset is already uploaded, vote Commit-Queue+1 via /google/bin/releases/gemini-agents-gerrit/gerrit:

/google/bin/releases/gemini-agents-gerrit/gerrit vote Commit-Queue 1 \
  --change=<CL_NUMBER> \
  --host=https://chromium-review.googlesource.com
Step 2 — Poll for `ChromiumCodeReviewAgent` findings

Poll every ~60 seconds (up to ~5 minutes) until the ChromiumCodeReviewAgent run completes:

  1. Check whether the ChromiumCodeReviewAgent run has reached "status": "COMPLETED":

```bash

gerrit_client.py checks \

--host https://chromium-review.googlesource.com \

--change <CL_NUMBER> \

--revision <PS> \

--json_file <TMP_CHECKS_JSON>

```

  1. Fetch the findings with /google/bin/releases/gemini-agents-gerrit/gerrit findings (include --all because ChromiumCodeReviewAgent marks WARNING findings actionable: false, which gerrit findings omits by default; if the internal binary is unavailable, read results on the ChromiumCodeReviewAgent entry in <TMP_CHECKS_JSON>):

```bash

/google/bin/releases/gemini-agents-gerrit/gerrit findings \

--change=<CL_NUMBER> \

--patchset=<PS> \

--all \

--json \

--host=https://chromium-review.googlesource.com

```

Step 3 — Address findings before starting human review

Inspect all ChromiumCodeReviewAgent findings with ERROR or WARNING severity (consulting .agents/skills/code-review/SKILL.md, including its Shared False-Positive Guards):

```bash

/google/bin/releases/gemini-agents-gerrit/gerrit messages post \

--change=<CL_NUMBER> \

--message="<explanation citing ref: f/...>" \

--host=https://chromium-review.googlesource.com

```

```bash

/google/bin/releases/gemini-agents-gerrit/gerrit reviewers add \

--change=<CL_NUMBER> \

--ready \

--reviewer=<reviewer1@chromium.org>,<reviewer2@chromium.org> \

--host=https://chromium-review.googlesource.com

```

(Or run git cl upload -f --send-mail -r <reviewer1@chromium.org> -r <reviewer2@chromium.org>.)

Subsequent upload & Updating Stacks

To upload an updated CL:

git cl upload -f --cq-dry-run -t "<one sentence patch set description>"

Release and Roll Status

To check whether a DevTools commit (devtools/devtools-frontend) has rolled into chromium/src (Roll status) and what version or channel it is deployed to (Release status), look it up via the Chromium Dash API:

https://chromiumdash.appspot.com/fetch_commit?commit=<sha>

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 |

| Initial WIP CL upload + CQ dry run | git cl upload -f --cq-dry-run -o wip --commit-description=+ |

| Poll ChromiumCodeReviewAgent findings | /google/bin/releases/gemini-agents-gerrit/gerrit findings --change=<CL> --patchset=<PS> --all --json --host=https://chromium-review.googlesource.com |

| Mark Ready for Review & add reviewers | /google/bin/releases/gemini-agents-gerrit/gerrit reviewers add --change=<CL> --ready --reviewer=<emails> --host=https://chromium-review.googlesource.com |

| Subsequent CL upload (or update stack from leaf) | git cl upload -f --cq-dry-run -t "<message>" |

| Reparent branch to root (origin/main) | git reparent-branch --root |

| Change branch parent | git reparent-branch <new-parent> |

| Archive landed/closed branches | git cl archive -f |

| Rebase all branches in stack | git rebase-update |

| Sync dependencies after rebase | gclient sync -Df |

| Check release & roll status | Query https://chromiumdash.appspot.com/fetch_commit?commit=<sha> |

Common Mistakes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.