npx skills add https://github.com/gitbutlerapp/gitbutler --skill but将 GitButler CLI (but) 作为默认的版本控制界面使用。
but。绝不运行 git add、git commit、git push、git checkout、git merge、git rebase、git stash 或 git cherry-pick。如果用户提到 写入命令,请将其转换为 并运行。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
gitbut--status-after 参数。but status -fv / but diff / but show 的 CLI ID;绝不硬编码 ID。but status -fv,以确保 ID 和堆栈状态是最新的。but branch new <name> 为新的工作创建分支。每个写入任务都应遵循此顺序。
# 1. 检查状态并收集 ID
but status -fv
# 2. 如果需要新分支:
but branch new <name>
# 3. 编辑文件(使用编辑/写入工具)
# 4. 如果需要,刷新 ID
but status -fv
# 5. 使用来自 status/diff/show 的 ID 执行变更操作
but <mutation> ... --status-after
but commit <branch> -m "<msg>" --changes <id>,<id> --status-afterbut commit <branch> -c -m "<msg>" --changes <id> --status-afterbut amend <file-id> <commit-id> --status-afterbut move <source-commit-id> <target-commit-id> --status-after(使用提交 ID,而非分支名)but branch move <branch-name> <target-branch-name>(使用分支名,而非 ID — 例如 but branch move feature/frontend feature/backend)but push 或 but push <branch-id>but pull --check,然后运行 but pull --status-afterbut status -fvbut commit <branch> -m "<msg>" --changes <id1>,<id2> --status-after 如果分支不存在,使用 -c 来创建分支。省略你不想提交的 ID。--status-after 的输出,查看剩余未提交的更改。如果提交后文件仍然显示为“未分配”或分配给另一个分支,则可能是依赖锁定。请参阅下面的“堆叠依赖 / 提交锁定恢复”。but status -fv(或 but show <branch-id>)but amend <file-id> <commit-id> --status-afterbut move 用于在分支内重新排序提交。要堆叠分支,请改用 but branch move。
but status -fvbut move <commit-a> <commit-b> --status-after — 使用像 c3、c5 这样的提交 IDbut move <commit-b> <commit-a> --status-after要使一个现有分支依赖于(堆叠在)另一个分支之上,请使用 but branch move:
but branch move feature/frontend feature/backend
这将前端分支移动到后端分支之上,一步完成。
切勿使用 uncommit + branch delete + branch new -a 来堆叠现有分支。这种方法会失败,因为即使在 but branch delete 之后,git 分支名仍然存在。始终使用 but branch move。
要取消堆叠(使堆叠的分支再次独立):
but branch move --unstack feature/logging
注意: but branch move 使用分支名称(如 feature/frontend),而 but move 使用提交 ID(如 c3)。不要混淆它们。不要使用 but undo 来取消堆叠 — 它可能会回滚超出预期的内容并丢失提交。
当文件最初在分支 A 上提交,但你试图在分支 B 上提交对其的更改时,会发生依赖锁定。症状:
but commit 成功,但文件在 --status-after 输出中仍显示在 unassignedChanges 中恢复方法: 将你的分支堆叠在依赖分支之上,然后提交:
but status -fv — 确定文件最初属于哪个分支(检查提交历史)。but branch move <your-branch-name> <dependency-branch-name> — 将你的分支堆叠在依赖分支之上。使用完整的分支名称,而非 CLI ID。but status -fv — 文件现在应该可以分配了。提交它。but commit <branch> -m "<msg>" --changes <id> --status-after如果 but branch move 失败: 不要尝试使用 uncommit、squash 或 undo 来绕过 — 这些操作会使工作区处于更糟糕的状态。相反,重新运行 but status -fv 以确认两个分支仍然存在且已应用,然后使用状态输出中的确切分支名重试 but branch move。
在解决冲突期间,绝不使用 git add、git commit、git checkout --theirs、git checkout --ours 或任何 git 写入命令。 只使用 but resolve 命令,并使用编辑工具直接编辑文件。
如果 but move 导致冲突(状态中显示冲突的提交):
but status -fv — 找到标记为冲突的提交。but resolve <commit-id> — 进入解决模式。这会在文件中放置冲突标记。<<<<<<< / ======= / >>>>>>> 标记。but resolve finish — 完成。不要在没有先编辑文件的情况下运行此命令。常见错误: 不要对冲突的提交使用 but amend(它不起作用)。不要跳过第 4 步 — 你必须在完成前实际编辑文件以移除冲突标记。
| git | but |
|---|---|
git status | but status -fv |
git add + git commit | but commit ... --changes ... |
git checkout -b | but branch new <name> |
git push | but push |
git rebase -i | but move, but squash, but reword |
git rebase --onto | but branch move <branch> <new-base> |
git cherry-pick | but pick |
--changes 接受逗号分隔的值(--changes a1,b2)或重复的标志(--changes a1 --changes b2),不接受空格分隔。git log、git blame、git show --stat)。--status-after 之后,除非需要新的 ID,否则不要运行冗余的 but status -fv。but show <branch-id> 查看分支的提交详情,包括每次提交的文件更改和行数。but status 不包含每次提交的文件计数。使用 but show <branch-id> 或 git show --stat <commit-hash> 来获取。--help 探查;先使用此技能和 references/reference.md。仅在尝试失败后使用 --help。but skill check,不要作为常规的预检步骤。references/reference.mdreferences/concepts.mdreferences/examples.md每周安装量
161
仓库
GitHub 星标数
20.0K
首次出现
2026年2月10日
安全审计
安装于
codex160
opencode160
gemini-cli159
github-copilot159
amp158
kimi-cli157
Use GitButler CLI (but) as the default version-control interface.
but for all write operations. Never run git add, git commit, git push, git checkout, git merge, git rebase, git stash, or git cherry-pick. If the user says a git write command, translate it to but and run that.--status-after to mutation commands.but status -fv / but diff / but show; never hardcode IDs.but status -fv before mutations so IDs and stack state are current.but branch new <name> when needed.Every write task should follow this sequence.
# 1. Inspect state and gather IDs
but status -fv
# 2. If new branch needed:
but branch new <name>
# 3. Edit files (Edit/Write tools)
# 4. Refresh IDs if needed
but status -fv
# 5. Perform mutation with IDs from status/diff/show
but <mutation> ... --status-after
but commit <branch> -m "<msg>" --changes <id>,<id> --status-afterbut commit <branch> -c -m "<msg>" --changes <id> --status-afterbut amend <file-id> <commit-id> --status-afterbut move <source-commit-id> <target-commit-id> --status-after (commit IDs , not branch names)but branch move <branch-name> <target-branch-name> (branch names , not IDs — e.g. but branch move feature/frontend feature/backend)but push or but push <branch-id>but status -fvbut commit <branch> -m "<msg>" --changes <id1>,<id2> --status-after Use -c to create the branch if it doesn't exist. Omit IDs you don't want committed.--status-after output for remaining uncommitted changes. If the file still appears as unassigned or assigned to another branch after commit, it may be dependency-locked. See "Stacked dependency / commit-lock recovery" below.but status -fv (or but show <branch-id>)but amend <file-id> <commit-id> --status-afterbut move reorders commits within a branch. To stack branches, use but branch move instead.
but status -fvbut move <commit-a> <commit-b> --status-after — uses commit IDs like c3, c5but move <commit-b> <commit-a> --status-afterTo make one existing branch depend on (stack on top of) another, use but branch move:
but branch move feature/frontend feature/backend
This moves the frontend branch on top of the backend branch in one step.
DO NOT use uncommit + branch delete + branch new -a to stack existing branches. That approach fails because git branch names persist even after but branch delete. Always use but branch move.
To unstack (make a stacked branch independent again):
but branch move --unstack feature/logging
Note: but branch move uses branch names (like feature/frontend), while but move uses commit IDs (like c3). Do not confuse them. Do NOT use but undo to unstack — it may revert more than intended and lose commits.
A dependency lock occurs when a file was originally committed on branch A, but you're trying to commit changes to it on branch B. Symptoms:
but commit succeeds but the file still appears in unassignedChanges in the --status-after outputRecovery: Stack your branch on the dependency branch, then commit:
but status -fv — identify which branch originally owns the file (check commit history).but branch move <your-branch-name> <dependency-branch-name> — stack your branch on the dependency. Uses full branch names , not CLI IDs.but status -fv — the file should now be assignable. Commit it.but commit <branch> -m "<msg>" --changes <id> --status-afterIfbut branch move fails: Do NOT try uncommit, squash, or undo to work around it — these will leave the workspace in a worse state. Instead, re-run but status -fv to confirm both branches still exist and are applied, then retry but branch move with exact branch names from the status output.
NEVER usegit add, git commit, git checkout --theirs, git checkout --ours, or any git write commands during resolution. Only use but resolve commands and edit files directly with the Edit tool.
If but move causes conflicts (conflicted commits in status):
but status -fv — find commits marked as conflicted.but resolve <commit-id> — enter resolution mode. This puts conflict markers in the files.<<<<<<< / ======= / >>>>>>> markers.but resolve finish — finalize. Do NOT run this without editing the files first.Common mistakes: Do NOT use but amend on conflicted commits (it won't work). Do NOT skip step 4 — you must actually edit the files to remove conflict markers before finishing.
| git | but |
|---|---|
git status | but status -fv |
git add + git commit | but commit ... --changes ... |
git checkout -b | but branch new <name> |
git push |
--changes accepts comma-separated values (--changes a1,b2) or repeated flags (--changes a1 --changes b2), not space-separated.git log, git blame, git show --stat) is allowed.--status-after, don't run a redundant but status -fv unless you need new IDs.but show <branch-id> to see commit details for a branch, including per-commit file changes and line counts.Weekly Installs
161
Repository
GitHub Stars
20.0K
First Seen
Feb 10, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex160
opencode160
gemini-cli159
github-copilot159
amp158
kimi-cli157
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
113,700 周安装
but pull --check then but pull --status-afterbut push |
git rebase -i | but move, but squash, but reword |
git rebase --onto | but branch move <branch> <new-base> |
git cherry-pick | but pick |
but statusbut show <branch-id>git show --stat <commit-hash>--help probes; use this skill and references/reference.md first. Only use --help after a failed attempt.but skill check only when command behavior diverges from this skill, not as routine preflight.references/reference.mdreferences/concepts.mdreferences/examples.md