xit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Xit (xit)

Xit (xit)

Rule (when to trigger)

触发规则

Use
xit
instead of
git
when either is true:
  • A
    .xit/
    directory exists in this repo (including in a parent directory).
  • The user explicitly asks for xit (e.g. “use xit”, “.xit repo”, “xit status”).
If the repo is not a xit repo and the user didn’t ask for xit, do not force this skill.
当满足以下任一条件时,使用
xit
而非
git
  • 此仓库(包括父目录)中存在
    .xit/
    目录。
  • 用户明确要求使用xit(例如:“使用xit”、“.xit仓库”、“xit status”)。
如果仓库不是xit仓库且用户未要求使用xit,请勿强制使用此工具。

Non-interactive defaults

非交互式默认规则

  • Never run bare
    xit
    (it launches the TUI).
  • Always use
    --cli
    for
    status
    ,
    diff
    ,
    diff-added
    , and
    log
    (their default is TUI).
  • Avoid TUI entrypoints (e.g.
    xit config
    ); use
    xit config list|add|rm ...
    instead.
  • Prefer
    --cli
    whenever it’s available; check
    xit <cmd> --help
    if unsure.
  • 永远不要直接运行
    xit
    (这会启动TUI)。
  • 对于
    status
    diff
    diff-added
    log
    命令,必须使用
    --cli
    参数(它们的默认行为是启动TUI)。
  • 避免使用TUI入口(如
    xit config
    );应使用
    xit config list|add|rm ...
    这类命令替代。
  • 只要有
    --cli
    参数可用,优先使用;若不确定,可查看
    xit <cmd> --help

Preflight

预检查

  1. Confirm
    xit
    is available:
    command -v xit
    .
    • If missing, ask the user to install/provide
      xit
      .
    • If they decline, do not attempt to “fake it” with
      git
      ; ask how they want to proceed.
  2. Confirm you’re in a xit repo:
    • Prefer:
      xit status --cli
      (it should discover
      .xit/
      from subdirectories).
  1. 确认
    xit
    可用:执行
    command -v xit
    • 若未安装,请用户安装/提供
      xit
    • 若用户拒绝,请勿尝试用
      git
      模拟;询问用户希望如何继续。
  2. 确认当前处于xit仓库:
    • 优先执行
      xit status --cli
      (它能从子目录中识别
      .xit/
      目录)。

Top mapping (git-like intent → xit)

核心映射(类Git操作意图 → xit命令)

IntentxitNotes
status
xit status --cli
Text output for agents.
diff (working tree)
xit diff --cli
Changes not added to index.
diff --cached
xit diff-added --cli
Index vs last commit.
add / stage
xit add <path>
Stage file contents.
unstage
xit unadd <path>
Like
git reset HEAD <path>
.
restore (work dir)
xit restore <path>
Discard local changes for a path.
rm --cached
xit untrack <path>
Stop tracking but keep the file.
rm
xit rm <path>
Stop tracking and delete the file.
commit
xit commit -m "msg"
Use a quoted message.
log
xit log --cli
Text output for agents.
branch list / create / delete
xit branch list
/
xit branch add <name>
/
xit branch rm <name>
switch / checkout
xit switch <name-or-oid>
Updates index + working dir.
merge
xit merge <branch-or-oid>
Patch-based merge by default.
cherry-pick
xit cherry-pick <oid>
Apply an existing commit.
For a more complete mapping and workflows, see
references/cli.md
.
操作意图xit命令说明
查看状态
xit status --cli
适合Agent的文本输出格式。
查看工作区差异
xit diff --cli
未暂存的更改。
查看暂存区与提交差异
xit diff-added --cli
暂存区与最新提交的差异。
暂存文件
xit add <path>
暂存文件内容。
取消暂存
xit unadd <path>
类似
git reset HEAD <path>
恢复工作区文件
xit restore <path>
丢弃指定路径的本地更改。
停止追踪文件但保留本地文件
xit untrack <path>
停止追踪但保留文件。
删除文件并停止追踪
xit rm <path>
停止追踪并删除文件。
提交
xit commit -m "msg"
使用带引号的提交信息。
查看提交日志
xit log --cli
适合Agent的文本输出格式。
分支列表/创建/删除
xit branch list
/
xit branch add <name>
/
xit branch rm <name>
切换分支/检出
xit switch <name-or-oid>
更新暂存区和工作区。
合并
xit merge <branch-or-oid>
默认基于补丁的合并。
樱桃拣选
xit cherry-pick <oid>
应用已有的提交。
如需更完整的命令映射和工作流程,请查看
references/cli.md

Common workflows

常见工作流程

Inspect changes

检查更改

  • xit status --cli
  • xit diff --cli
  • xit diff-added --cli
  • xit status --cli
  • xit diff --cli
  • xit diff-added --cli

Commit cycle

提交流程

  • xit status --cli
  • xit diff --cli
  • xit add <paths...>
  • xit diff-added --cli
  • xit commit -m "<message>"
  • xit status --cli
  • xit diff --cli
  • xit add <paths...>
  • xit diff-added --cli
  • xit commit -m "<message>"

Merge / cherry-pick (conflicts)

合并/樱桃拣选(处理冲突)

  • Start:
    xit merge <branch-or-oid>
    or
    xit cherry-pick <oid>
    .
  • Inspect:
    xit status --cli
    and
    xit diff --cli
    .
  • If conflicts:
    • Resolve conflicts in the working tree.
    • Stage resolutions:
      xit add <resolved-paths...>
      then
      xit diff-added --cli
      .
    • Continue:
      xit merge --continue
      or
      xit cherry-pick --continue
      .
  • To abandon the operation:
    xit merge --abort
    or
    xit cherry-pick --abort
    .
  • 开始操作:
    xit merge <branch-or-oid>
    xit cherry-pick <oid>
  • 检查状态:
    xit status --cli
    xit diff --cli
  • 若存在冲突:
    • 在工作区解决冲突。
    • 暂存解决结果:
      xit add <resolved-paths...>
      ,然后执行
      xit diff-added --cli
      确认。
    • 继续操作:
      xit merge --continue
      xit cherry-pick --continue
  • 放弃操作:
    xit merge --abort
    xit cherry-pick --abort

Reset semantics (git reset equivalents)

重置语义(对应Git reset命令)

  • Move branch pointer, index only:
    xit reset <ref-or-oid>
    (like
    git reset --mixed
    ).
  • Move branch pointer + working dir:
    xit reset-dir <ref-or-oid>
    (like
    git reset --hard
    ).
  • Move branch pointer only:
    xit reset-add <ref-or-oid>
    (like
    git reset --soft
    ).
  • 仅移动分支指针和暂存区:
    xit reset <ref-or-oid>
    (类似
    git reset --mixed
    )。
  • 移动分支指针并重置工作区:
    xit reset-dir <ref-or-oid>
    (类似
    git reset --hard
    )。
  • 仅移动分支指针:
    xit reset-add <ref-or-oid>
    (类似
    git reset --soft
    )。

Remotes (pull is not implemented)

远程仓库(pull功能未实现)

  • Manage remotes:
    xit remote add|rm|list ...
  • Pull equivalent:
    • xit fetch <remote>
    • xit merge refs/remotes/<remote>/<branch>
      (choose
      <branch>
      by inspecting refs or
      xit log --cli
      after fetch)
  • Push:
    • xit push <remote> <branch>
  • 管理远程仓库:
    xit remote add|rm|list ...
  • 替代pull的操作:
    • xit fetch <remote>
    • xit merge refs/remotes/<remote>/<branch>
      (在fetch后,可通过查看引用或
      xit log --cli
      选择对应的
      <branch>
  • 推送:
    • xit push <remote> <branch>

Guardrails

安全防护

  • Require explicit user confirmation before running:
    xit rm <path>
    (deletes file),
    xit restore <path>
    /
    xit reset-dir <ref-or-oid>
    (discard local changes), or
    xit push ... -f
    /
    xit push <remote> :<branch>
    (force push / delete remote branch).
  • Prefer
    xit untrack <path>
    when the user wants to stop tracking but keep the file.
  • Do not run
    git
    inside a
    .xit
    repo unless the user explicitly requests git.
  • 以下命令执行前需获得用户明确确认
    xit rm <path>
    (删除文件)、
    xit restore <path>
    /
    xit reset-dir <ref-or-oid>
    (丢弃本地更改)、
    xit push ... -f
    /
    xit push <remote> :<branch>
    (强制推送/删除远程分支)。
  • 当用户希望停止追踪文件但保留本地文件时,优先使用
    xit untrack <path>
  • 除非用户明确要求,否则不要在
    .xit
    仓库中运行
    git
    命令。

If a command seems missing

若找不到对应命令

  • Check
    xit --help
    and
    xit <cmd> --help
    .
  • If it isn’t available, explain the limitation and ask for direction.
  • 查看
    xit --help
    xit <cmd> --help
  • 若确实不存在该命令,请说明限制并询问用户的指示。

Notes

注意事项

  • Patch-based merge controls:
    xit patch on|off|all
    .
  • 基于补丁的合并控制:
    xit patch on|off|all