jujutsu

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Jujutsu

Jujutsu

Git-compatible VCS focused on concurrent development and ease of use.
与Git兼容的版本控制系统,专注于并行开发和易用性。

Key Commands

核心命令

CommandDescription
jj st
Show working copy status
jj log
Show change log
jj diff
Show changes in working copy
jj new
Create new change
jj desc
Edit change description
jj squash
Move changes to parent
jj split
Split current change
jj rebase -s src -d dest
Rebase changes
jj absorb
Move changes into stack of mutable revisions
jj bisect
Find bad revision by bisection
jj fix
Update files with formatting fixes
jj sign
Cryptographically sign a revision
jj metaedit
Modify metadata without changing content
命令描述
jj st
显示工作副本状态
jj log
显示变更日志
jj diff
显示工作副本中的变更
jj new
创建新变更
jj desc
编辑变更描述
jj squash
将变更合并至父提交
jj split
拆分当前变更
jj rebase -s src -d dest
变基变更
jj absorb
将变更移入可变修订的堆栈中
jj bisect
通过二分查找定位有问题的修订
jj fix
用格式修复更新文件
jj sign
对修订进行加密签名
jj metaedit
修改元数据而不改变内容

Project Setup

项目设置

bash
jj git init              # Init in existing git repo
jj git init --colocate   # Side-by-side with git
bash
jj git init              # 在现有Git仓库中初始化
jj git init --colocate   # 与Git并排使用

Basic Workflow

基础工作流

bash
jj new                   # Create new change
jj desc -m "feat: add feature"  # Set description
jj log                   # View history
jj edit change-id        # Switch to change
jj new --before @        # Time travel (create before current)
jj edit @-               # Go to parent
bash
jj new                   # 创建新变更
jj desc -m "feat: add feature"  # 设置描述
jj log                   # 查看历史
jj edit change-id        # 切换至指定变更
jj new --before @        # 时间回溯(在当前变更前创建新变更)
jj edit @-               # 切换至父变更

Time Travel

时间回溯

bash
jj edit change-id        # Switch to specific change
jj next --edit           # Next child change
jj edit @-               # Parent change
jj new --before @ -m msg # Insert before current
bash
jj edit change-id        # 切换至指定变更
jj next --edit           # 切换至下一个子变更
jj edit @-               # 切换至父变更
jj new --before @ -m msg # 在当前变更前插入新变更

Merging & Rebasing

合并与变基

bash
jj new x yz -m msg       # Merge changes
jj rebase -s src -d dest # Rebase source onto dest
jj abandon              # Delete current change
bash
jj new x yz -m msg       # 合并变更
jj rebase -s src -d dest # 将源变更变基至目标变更
jj abandon              # 删除当前变更

Conflicts

冲突处理

bash
jj resolve              # Interactive conflict resolution
bash
jj resolve              # 交互式冲突解决

Edit files, then continue

编辑文件后继续操作

undefined
undefined

Templates & Revsets

模板与修订集

bash
jj log -T 'commit_id ++ "\n" ++ description'
jj log -r 'heads(all())'    # All heads
jj log -r 'remote_bookmarks()..'  # Not on remote
jj log -r 'author(name)'    # By author
bash
jj log -T 'commit_id ++ "\n" ++ description'
jj log -r 'heads(all())'    # 查看所有分支头
jj log -r 'remote_bookmarks()..'  # 查看未推送到远程的变更
jj log -r 'author(name)'    # 按作者筛选变更

Git Interop

Git互操作

bash
jj bookmark create main -r @  # Create bookmark
jj git push --bookmark main   # Push bookmark
jj git fetch                 # Fetch from remote
jj bookmark track main@origin # Track remote
bash
jj bookmark create main -r @  # 创建书签
jj git push --bookmark main   # 推送书签
jj git fetch                 # 从远程拉取
jj bookmark track main@origin # 追踪远程书签

Advanced Commands

高级命令

bash
jj absorb               # Auto-move changes to relevant commits in stack
jj bisect start         # Start bisection
jj bisect good          # Mark current as good
jj bisect bad           # Mark current as bad
jj fix                  # Run configured formatters on files
jj sign -r @            # Sign current revision
jj metaedit -r @ -m "new message"  # Edit metadata only
bash
jj absorb               # 自动将变更移入堆栈中相关的提交
jj bisect start         # 开始二分查找
jj bisect good          # 将当前标记为正常
jj bisect bad           # 将当前标记为异常
jj fix                  # 对文件运行配置的格式化工具
jj sign -r @            # 对当前修订签名
jj metaedit -r @ -m "new message"  # 仅编辑元数据

Tips

小贴士

  • No staging: changes are immediate
  • Use conventional commits:
    type(scope): desc
  • jj undo
    to revert operations
  • jj op log
    to see operation history
  • Bookmarks are like branches
  • jj absorb
    is powerful for fixing up commits in a stack
  • 无暂存区:变更即时生效
  • 使用规范提交格式:
    type(scope): desc
  • 使用
    jj undo
    撤销操作
  • 使用
    jj op log
    查看操作历史
  • 书签功能类似分支
  • jj absorb
    在修复堆栈中的提交时非常实用

Related Skills

相关技能

  • gh: GitHub CLI for PRs and issues
  • review: Code review before committing
  • gh: 用于PR和议题的GitHub CLI
  • review: 提交前的代码审查