xit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseXit (xit)
Xit (xit)
Rule (when to trigger)
触发规则
Use instead of when either is true:
xitgit- A directory exists in this repo (including in a parent directory).
.xit/ - 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.
当满足以下任一条件时,使用而非:
xitgit- 此仓库(包括父目录)中存在目录。
.xit/ - 用户明确要求使用xit(例如:“使用xit”、“.xit仓库”、“xit status”)。
如果仓库不是xit仓库且用户未要求使用xit,请勿强制使用此工具。
Non-interactive defaults
非交互式默认规则
- Never run bare (it launches the TUI).
xit - Always use for
--cli,status,diff, anddiff-added(their default is TUI).log - Avoid TUI entrypoints (e.g. ); use
xit configinstead.xit config list|add|rm ... - Prefer whenever it’s available; check
--cliif unsure.xit <cmd> --help
- 永远不要直接运行(这会启动TUI)。
xit - 对于、
status、diff和diff-added命令,必须使用log参数(它们的默认行为是启动TUI)。--cli - 避免使用TUI入口(如);应使用
xit config这类命令替代。xit config list|add|rm ... - 只要有参数可用,优先使用;若不确定,可查看
--cli。xit <cmd> --help
Preflight
预检查
- Confirm is available:
xit.command -v xit- If missing, ask the user to install/provide .
xit - If they decline, do not attempt to “fake it” with ; ask how they want to proceed.
git
- If missing, ask the user to install/provide
- Confirm you’re in a xit repo:
- Prefer: (it should discover
xit status --clifrom subdirectories)..xit/
- Prefer:
- 确认可用:执行
xit。command -v xit- 若未安装,请用户安装/提供。
xit - 若用户拒绝,请勿尝试用模拟;询问用户希望如何继续。
git
- 若未安装,请用户安装/提供
- 确认当前处于xit仓库:
- 优先执行(它能从子目录中识别
xit status --cli目录)。.xit/
- 优先执行
Top mapping (git-like intent → xit)
核心映射(类Git操作意图 → xit命令)
| Intent | xit | Notes |
|---|---|---|
| status | | Text output for agents. |
| diff (working tree) | | Changes not added to index. |
| diff --cached | | Index vs last commit. |
| add / stage | | Stage file contents. |
| unstage | | Like |
| restore (work dir) | | Discard local changes for a path. |
| rm --cached | | Stop tracking but keep the file. |
| rm | | Stop tracking and delete the file. |
| commit | | Use a quoted message. |
| log | | Text output for agents. |
| branch list / create / delete | | |
| switch / checkout | | Updates index + working dir. |
| merge | | Patch-based merge by default. |
| cherry-pick | | Apply an existing commit. |
For a more complete mapping and workflows, see .
references/cli.md| 操作意图 | xit命令 | 说明 |
|---|---|---|
| 查看状态 | | 适合Agent的文本输出格式。 |
| 查看工作区差异 | | 未暂存的更改。 |
| 查看暂存区与提交差异 | | 暂存区与最新提交的差异。 |
| 暂存文件 | | 暂存文件内容。 |
| 取消暂存 | | 类似 |
| 恢复工作区文件 | | 丢弃指定路径的本地更改。 |
| 停止追踪文件但保留本地文件 | | 停止追踪但保留文件。 |
| 删除文件并停止追踪 | | 停止追踪并删除文件。 |
| 提交 | | 使用带引号的提交信息。 |
| 查看提交日志 | | 适合Agent的文本输出格式。 |
| 分支列表/创建/删除 | | |
| 切换分支/检出 | | 更新暂存区和工作区。 |
| 合并 | | 默认基于补丁的合并。 |
| 樱桃拣选 | | 应用已有的提交。 |
如需更完整的命令映射和工作流程,请查看。
references/cli.mdCommon workflows
常见工作流程
Inspect changes
检查更改
xit status --clixit diff --clixit diff-added --cli
xit status --clixit diff --clixit diff-added --cli
Commit cycle
提交流程
xit status --clixit diff --clixit add <paths...>xit diff-added --clixit commit -m "<message>"
xit status --clixit diff --clixit add <paths...>xit diff-added --clixit commit -m "<message>"
Merge / cherry-pick (conflicts)
合并/樱桃拣选(处理冲突)
- Start: or
xit merge <branch-or-oid>.xit cherry-pick <oid> - Inspect: and
xit status --cli.xit diff --cli - If conflicts:
- Resolve conflicts in the working tree.
- Stage resolutions: then
xit add <resolved-paths...>.xit diff-added --cli - Continue: or
xit merge --continue.xit cherry-pick --continue
- To abandon the operation: or
xit merge --abort.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: (like
xit reset <ref-or-oid>).git reset --mixed - Move branch pointer + working dir: (like
xit reset-dir <ref-or-oid>).git reset --hard - Move branch pointer only: (like
xit reset-add <ref-or-oid>).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>- (choose
xit merge refs/remotes/<remote>/<branch>by inspecting refs or<branch>after fetch)xit log --cli
- Push:
xit push <remote> <branch>
- 管理远程仓库:
xit remote add|rm|list ... - 替代pull的操作:
xit fetch <remote>- (在fetch后,可通过查看引用或
xit merge refs/remotes/<remote>/<branch>选择对应的xit log --cli)<branch>
- 推送:
xit push <remote> <branch>
Guardrails
安全防护
- Require explicit user confirmation before running: (deletes file),
xit rm <path>/xit restore <path>(discard local changes), orxit reset-dir <ref-or-oid>/xit push ... -f(force push / delete remote branch).xit push <remote> :<branch> - Prefer when the user wants to stop tracking but keep the file.
xit untrack <path> - Do not run inside a
gitrepo unless the user explicitly requests git..xit
- 以下命令执行前需获得用户明确确认:(删除文件)、
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 and
xit --help.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