跳到正文
cccskills
免费在 GitHub 公开中文介绍

Jujutsu (jj) usage

本指南介绍如何在 Carbon 仓库中使用 Jujutsu(jj)管理版本,包括查看状态、差异和历史、提交更改、同步远程内容,以及确定更改栈的基点并谨慎处理历史。

原文查看原文说明

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

carbon-language/carbon-lang星标 33,929(GitHub 33,929 + cccskills 0)

实测评分 未实测

查看安装方法

适用场景

  • 用 jj 查看状态和历史
  • 从远程获取更改
  • 查找更改栈的基点
  • 提交并整理更改

中文介绍

功能

本指南介绍在 Carbon 仓库中使用 Jujutsu(jj)进行日常版本管理。内容包括从远程获取更改、在 trunk 上开始新更改、查看仓库状态、历史和差异,以及提交更改。若多个更改组成一个待提交的拉取请求,本指南会说明如何通过书签找出更改栈的基点,并将命令限定在相关范围内。指南还涉及把工作内容合并进已有更改,以及编写更改说明。

适用场景

当 Carbon 工作副本使用 Jujutsu,而你需要进行常见版本管理操作时,可以参考本指南。它可以帮助你判断更改栈以哪个书签为基点、处理包含评审中更改的栈,并在改写历史前检查可能影响。

使用示例

  • “请用 jj 获取远程更改,并在 trunk 上开始一项新更改。”
  • “请查看我当前更改的差异和历史。”
  • “请找出这个更改栈的基点,并显示相关范围。”

注意事项

仅当仓库根目录存在 .jj 目录时才使用 jj;没有该目录时不要使用。运行 jj 命令时添加 --no-pager。绝不要改写已作为拉取请求提交的更改历史。对其他已有更改执行 squash、rebase、abandon 或 describe 前,应先展示准确命令并等待确认。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

文档检查

AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。

安全性发送数据、删除文件、执行命令等是否有说明
A良好资料禁止改写已提交拉取请求的历史,其他改写需先确认。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足资料用 `.jj` 目录判断是否适用,但未提供安装步骤。

不计入评分。 由 AI(OpenAI Codex)于 2026年10月26日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(1)

  • SKILL.md3.9 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

本技能介绍如何使用命令行`gh`只读查看GitHub issue正文和评论,支持通过编号或URL定位,也可指定其他仓库,并说明如何提取大量评论。

  • 查看issue正文和评论
  • 通过URL读取issue
  • 查看其他仓库的issue
carbon-language/carbon-lang3.4万2026年10月26日 更新

Agent tools

免费有简介

本技能为在 Carbon 代码库中工作的 AI 助手规定文件查看、搜索和编辑工具,并说明临时文件的存放与清理规则,以及何时可以编写和运行自定义程序。

  • 按规定工具搜索Carbon文件
  • 为文件编辑选择专用工具
  • 确认临时文件的存放与清理规则
carbon-language/carbon-lang3.4万2026年10月26日 更新

Bazel usage

免费有简介

了解如何在 Carbon 项目中通过 Bazelisk 构建、测试和运行程序,包括指定目标、启用 ASan,以及系统依赖变更后重建缓存。

  • 构建 Carbon 代码
  • 运行与修改相关的测试
  • 启动 Bazel 构建的程序
carbon-language/carbon-lang3.4万2026年10月26日 更新

Builtin functions

免费有简介

本技能介绍如何为Carbon编译器添加内置函数,包括类型注册、签名验证、常量求值、运行时LLVM IR生成、Prelude绑定,以及使用最小Prelude编写针对性测试。

  • 注册内置函数
  • 实现常量求值
  • 添加LLVM IR生成
carbon-language/carbon-lang3.4万2026年10月26日 更新

Code style

免费有简介

了解 Carbon 工具链对 Bazel、C++、Carbon、Markdown 和 Python 文件的格式规范,并查看注释、文档、命名、设计及提交说明的写作要求。

  • 整理 Carbon 代码格式
  • 检查注释和文档
  • 确认名称是否符合实际含义
carbon-language/carbon-lang3.4万2026年10月26日 更新

Diagnostics

免费有简介

本技能介绍如何在Carbon工具链中添加或修改错误和警告,包括注册诊断类型、用带类型的参数构造消息、为源码位置添加标签和上下文,以及检查措辞规范和测试覆盖。

  • 添加诊断消息
  • 为源码位置添加标签
  • 统一诊断措辞
carbon-language/carbon-lang3.4万2026年10月26日 更新

查看 carbon-language 的全部技能

报告此技能的问题