Skip to content
cccskills
FreePublished on GitHubEnglish overview

Jujutsu (jj) usage

Use this guide to manage Carbon repository changes with Jujutsu (jj), a Git-compatible version control system. It covers status, diffs, commits, remote syncing, and change stacks, including how to identify a stack's base and handle history safely.

OriginalShow the original description

Instructions for using Jujutsu (jj) for version control in the Carbon repository.

carbon-language/carbon-lang33,929 stars(GitHub 33,929 + cccskills 0)

Run score Not tested

See how to install

Good for

  • Checking repository status and change history
  • Fetching remote changes and starting work on trunk
  • Committing or reviewing a change with jj
  • Finding the base of a stacked change

Overview

What it does

This guide covers everyday version control in the Carbon repository with Jujutsu (jj). It explains how to fetch from a remote, start a change on trunk, inspect repository status, history, and diffs, and commit changes. For a stack of changes intended for a pull request, it describes how to use bookmarks to find the stack’s base and limit commands to the relevant range. It also covers folding work into an existing change and writing change descriptions.

When it helps

Use this guide when your Carbon checkout uses Jujutsu and you need help with routine version control tasks. It can help you determine which bookmark a change stack is based on, work with a stack that includes changes under review, and check the impact before rewriting history.

Example requests

  • “Fetch remote changes with jj and start a new change on trunk.”
  • “Show me the diff and history for my current changes.”
  • “Find the base of this change stack and show the relevant range.”

Notes

Use jj when the repository root contains a .jj directory; otherwise, do not use it. Add --no-pager to jj commands. Never rewrite history for a change already submitted as a pull request. For other existing changes, present the exact squash, rebase, abandon, or describe command and wait for confirmation before running it.

This overview was written by AI (OpenAI Codex) from the public SKILL.md. Check the original below for the exact behavior.

Document check

AI checked the SKILL.md for operations that need care and for setup requirements. The score comes only from actually running the skill (hands-on test).

SafetyAre sending data, deleting files, and running commands disclosed?
AGoodIt forbids rewriting submitted PR history and requires confirmation for other rewrites.
Easy setupDoes it need few tools or API keys, and are they documented?
BPartly lackingIt uses the `.jj` directory to determine applicability but gives no installation steps.

Not counted in the score. Rated by AI (OpenAI Codex) as of Oct 26, 2026. Treat it as a guide and read the original before installing.

Disagree? Request a re-evaluation

Tell us which point is wrong and why. No login needed. We will check it against the SKILL.md, redo the evaluation, and show the result here.

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

Files included (1)

  • SKILL.md3.9 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Jujutsu (jj) usage

<!-- Part of the Carbon Language project, under the Apache License v2.0 with LLVM Exceptions. See /LICENSE for license information. SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -->

Jujutsu is a Git-compatible version control system that may be used in Carbon checkouts.

[!IMPORTANT] You can detect if Jujutsu is in use by checking for a .jj directory in the repository root. If present, you must use jj and must not use git. If absent, you must not use jj.

General usage

Always use the --no-pager flag when invoking jj to prevent the command from blocking or waiting for terminal paging.

Common commands

Syncing with remote

  • Fetch from remote: jj --no-pager git fetch
  • Create a new change on top of trunk: jj --no-pager new trunk
  • Show repository status: jj --no-pager status
  • Show commit history: jj --no-pager log

Managing changes

  • View diff of current changes: jj --no-pager diff
  • Commit changes: jj --no-pager commit
    • Note: Prefer using jj commit over the combination of jj describe and jj new.
  • Abandon/discard current changes: jj --no-pager abandon
  • Rebase current change onto trunk: jj --no-pager rebase -o trunk

Working with a stack of changes

A change is often built as a stack of commits sent up as a single pull request. The stack is not necessarily based on trunk; it may be based on another change that is itself still in flight.

[!WARNING] Never rewrite the history of a change that has been submitted as a pull request. Reviewers track a PR by its commits, and squashing, reordering, or abandoning them discards review that is already in progress. This cannot be undone from their side.

Before rewriting history in any other case, propose the exact command and wait for confirmation. This applies to squash, rebase, abandon, and describe on an existing change.

Finding the base of the stack

Bookmarks delimit the stack. List the bookmarks that are ancestors of the working copy, nearest first:

jj --no-pager log -r '::@ & bookmarks()'

Reading the result takes care, because two situations produce similar output:

  • Editing an existing change. The nearest bookmark names the change being worked on, and the bookmark below it is the base.
  • Starting a new change. The commits above the nearest bookmark have no bookmark of their own yet, so the nearest bookmark is itself the base.

trunk is only ever a base. Finding trunk nearest means new work is being built on top of it, never that trunk itself is being worked on.

The graph does not distinguish the two cases: an unbookmarked or empty commit above a bookmark may be the next commit of that change or the start of a new one. Ask which it is when it is not clear, and ask before choosing where a fix should land rather than after. Guessing wrong means squashing into a change that may already be under review.

Once the base is known, use it to scope commands to the current stack:

jj --no-pager log -r '<base-bookmark>..@'

Managing the stack

  • Fold a fix into an earlier change: jj --no-pager squash --into <change-id> [path]. Follow-up fixes and formatter reflows belong in the change that introduced the code, not in a trailing "fixes" commit, unless that change has already been submitted. Naming a path squashes only that part of the working copy, leaving unrelated work in place.
  • Descriptions: only one change in the stack needs a long description, the one used as the pull request description. Every other change gets a short one-line summary. Do not repeat the long text across the stack.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Use this skill to read GitHub issue details and comments from the command line with `gh`. It covers issues referenced by number or URL, including issues in other repositories, and keeps access read-only so issue state is not changed.

  • Reading an issue and its full comment history
  • Opening an issue referenced by URL
  • Viewing an issue from another repository
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Agent tools

FreeSummary

Use this skill to guide an AI assistant working in the Carbon repository on viewing, searching, and editing files with specialized environment tools. It also sets rules for temporary files and when custom programs may be used.

  • Choosing approved tools to view, search, or edit files
  • Checking where temporary analysis and test files belong
  • Deciding when a custom transformation program is allowed
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Bazel usage

FreeSummary

Follow the Carbon project's Bazel workflow through Bazelisk, a version-managing launcher. Learn commands for building targets, running tests and binaries, enabling AddressSanitizer, and refreshing cached state after system dependency changes.

  • Building a Carbon target
  • Running focused project tests
  • Launching a Bazel-built binary
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Use this skill to implement builtin functions in the Carbon compiler, from registering a function name and checking its signature to evaluating constant calls and generating LLVM IR for runtime calls. It also covers prelude bindings and focused tests.

  • Registering a new Carbon builtin function
  • Adding compile-time evaluation behavior
  • Lowering runtime builtins to LLVM IR
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Code style

FreeSummary

Apply Carbon toolchain conventions for formatting Bazel, C++, Carbon, Markdown, and Python files. The skill also covers clear comments and documentation, accurate names, design choices, and concise commit descriptions.

  • Formatting a changed source file
  • Writing or revising code comments
  • Choosing names that match their meaning
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Diagnostics

FreeSummary

Use this skill to add or revise diagnostics in the Carbon toolchain. It explains how to register message kinds, format typed arguments, attach source labels and context, and verify that diagnostics follow the project’s wording and test coverage rules.

  • Adding an error or warning to the Carbon compiler
  • Attaching source locations and explanatory labels
  • Checking diagnostic wording and formatting conventions
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

See all skills by carbon-language

Report a problem with this skill