but
Commit, push, branch, and manage version control with GitButler. Use for commits, selective dirty-file or hunk commits, branches, diffs, PRs, history edits, squashes, amends, undo, merge, fetching, pulling and syncing a branch with its remote, apply, unapply, and linked worktrees. For selected dirty files or hunks, inspect with `but diff`; use compact `but status` for commit order, branch/stack placement, or conflict overview; use `but status -fv` when file IDs or per-commit file details matter. Replaces git writes in verified GitButler-managed main worktrees. In linked or non-main worktrees, use plain Git: the installed wrapper rejects GitButler there.
- License 许可
- MIT
- 所属仓库
- 0xgleb/dotconfig
- 最近更新
- 2026-11-14
- Stars
- ★ 3
- Forks
- 0
01 前言 Front Matter
- name
- but
- author
- GitButler Team
- version
- 0.23.2
- description
- Commit, push, branch, and manage version control with GitButler. Use for commits, selective dirty-file or hunk commits, branches, diffs, PRs, history edits, squashes, amends, undo, merge, fetching, pulling and syncing a branch with its remote, apply, unapply, and linked worktrees. For selected dirty files or hunks, inspect with `but diff`; use compact `but status` for commit order, branch/stack placement, or conflict overview; use `but status -fv` when file IDs or per-commit file details matter. Replaces git writes in verified GitButler-managed main worktrees. In linked or non-main worktrees, use plain Git: the installed wrapper rejects GitButler there.
02 资源文件 3
- 参考文档references/concepts.md17.5 KB
- 参考文档references/examples.md11.5 KB
- 参考文档references/reference.md24.6 KB
03 SKILL.md 正文
GitButler CLI Skill
Use GitButler CLI (but) in verified GitButler-managed main worktrees. The
installed wrapper rejects all invocations from linked worktrees; use plain Git
in linked/non-main worktrees and unmanaged repositories. Native CLI worktree
capabilities described below are reference information, not permission to bypass
this local routing policy.
Before any history edit or conflict resolution, compare but --version with
this skill's declared version. Do not translate syntax from a stale version
report; consult the installed CLI's help when versions differ.
Start Here
Choose the narrowest first command by task; avoid ritual status checks:
# Selected dirty files/hunks:
but diff
# Commit order, branch/stack placement, conflict overview:
but status
# File IDs, per-commit files, amend details:
but status -fv
# What one applied branch or commit changed, for review:
but diff <branch-or-commit>
# Details for one known branch or commit:
but show <id>
Do not run plain but status and then but status -fv unless the compact
output lacks file details needed for the task.
For "commit just/only/specific changes on a new branch", use the fast path:
but diff
but commit -b <branch> -m "<msg>" <id> <id>
but commit -b <branch> ... creates the branch when it does not exist and
prints the created commit. Do not run a separate but branch new, status
command, or verification diff unless the task needs workspace information that
the result does not provide.
In a linked worktree, such as .claude/worktrees/*, omit -b so the commit
goes on the branch the worktree has checked out. Use that branch as the new
branch; do not stack another one on it. A worktree with a detached HEAD has no
branch yet. There, but commit -b <new-name> -m "<msg>" creates the branch at
HEAD, checks it out in that worktree, and commits to it.
IDs
The first token on each but diff / but status line is that line's ID. When a
command needs an ID, copy it exactly from the current output; never hardcode or
invent one. ID lifetimes differ by entity:
- Changes and sources are positional, space-separated IDs
(
but commit -b feat -m "msg" uvw:2e4 uvw:e2c). An uncommitted hunk ID is written<file-id>:<hunk-id>(e.g.uvw:2e4, copied from barebut diff) — the part after the colon is the hunk's ID, not a line range (uvw:16-40is invalid). Do not invent flags like--changes/--hunk/--ids, pass a line range, or comma-separate IDs —uvw,qyois parsed as one ID and fails. but diffis the exception: it accepts at most one target. Barebut diffshows all uncommitted files; inspect committed files or other entities one target at a time — neverbut diff <id> <id>.- A committed file is
<commit-id>:<file-id>(e.g.mzm:uvw, shown under each commit). A committed hunk is<commit-id>:<file-id>:<hunk-id>and is shown bybut diff <commit-id>.@means the uncommitted area. - Commit IDs are stable change IDs that survive history edits (
amend,squash,move,uncommit,reword). Commits without a change ID (e.g. upstream-only) lead with a sha prefix instead, and#N-suffixed refs disambiguate duplicates — both go stale after history edits, and a stale sha can silently resolve to the wrong commit. The(sha …)on verbose commit lines is informational — do not pass it to commands. - Branch short IDs are snapshot-local selectors. Use full branch names for branch-targeting mutations; short IDs are safe only for immediate read-only inspection.
- File/hunk IDs copied from one diff read generally remain usable across chained
commits. If one stops resolving, re-read
but diffand retry.
Chaining: mutation output is concise by default, so you may chain mutations
with && off one inspection read. Do not chain branch short IDs through
mutations; use full branch names. Add --status-after only when the next step
needs workspace IDs or details that the mutation result does not provide.
Chained but commit calls stack in the order written — the first is oldest,
each later one goes on top. History edits may run in sequence when every commit
ref involved is a change-ID ref; run them one at a time with --status-after
when a ref is sha-based or #N-suffixed, or when the next command needs freshly
issued IDs. Chaining but uncommit <id> && but diff is safe because bare diff
needs no ID from the uncommit output. Never pipe a mutation through tail or
head: the pipeline then exits with their status, so the next && runs even
when the mutation failed.
Non-Negotiable Rules
- Use
butfor all write operations. Never rungit add,git commit,git push,git fetch,git pull,git checkout,git merge,git rebase,git stash, orgit cherry-pick;but pull --checkfetches. The only exceptions are selecting a side of a conflicted submodule in resolution mode (see Resolve conflicted commits) and creating a missing target branch (see Notes). If the user says agitwrite command, translate it tobutand run that. - Mutation commands print their result without appending workspace status. Add
--status-afteronly when the next step needs resulting workspace IDs or details; otherwise trust the mutation result and do not run a verification status/diff. - Branches marked
(merged upstream)have landed; start new work on another branch. That marker alone does not meanbut pullremoves them: runbut pull --checkfirst.but pullremoves only branches listed[integrated]("has been integrated upstream and removed locally", or "has been merged into <target> and removed" when the target has no upstream) and rebases the rest, which stay applied. To clear a landed branch that stays applied, usebut unapply <branch>(acts on its whole stack) rather thanbut discard.pushand mutations (commit,amend,squash,uncommit,reword,move) refuse landed branches and commits,absorbskips them with a notice, andcommitskips them when picking a default target. - Keep going between routine
butcommands. Put any status note in the same message as the next command, and don't end a turn on a summary that announces the nextbutstep without running it. Finish with a concise summary. - Prefer this skill and
but skill referenceover exploratory help calls. Use<command> --helpwhen required syntax is missing or a command fails; use top-level help only when you genuinely need to discover an undocumented command. - Other agents may share this checkout, so
@can hold their edits. Commit, amend, and discard only the IDs or paths you changed. Barebut commit,but absorb,but discard @, andgit stashtake their work too, and a refusal naming files you didn't edit means you selected theirs.
Command Patterns
-
Initialize a Git repository:
but init(current directory) orbut -C <path> init. Non-interactive; creates no commits, remotes, or GitButler workspace. Existing repositories are left unchanged. In a repository with no commits, make the first commit with a barebut commit -m "<msg>";-bis refused there. -
Commit:
but commit -b <branch> -m "<msg>" <id> <id>—-b <branch>creates the branch if it does not exist -
Commit everything uncommitted:
but commit -b <branch> -m "<msg>"(omit the IDs) -
Several commits from one diff: chain
but commitcalls with&&(commits stack oldest-first) -
Never pass
-stocommit,move, orpick: it is--switch, not git's--signoff, and it unapplies every other stack. -
The branch is never positional (
but commit <branch>fails; use-b),but amendalways needs-t, andbut difftakes one target (use a shareddir/or one call each). -
Commit at a specific history position:
--above <commit-or-branch>or--below <commit-or-branch>(mutually exclusive). With a branch target, add-b <new-name>to name the new branch; otherwise its name is generated. The name must not already exist. Do not combine-b(even without a name) with commit/worktree targets. -
Targeting is required when more than one stack is applied; without it
but commitfails with "Unclear where to commit. Found more than one stack". Several branches stacked together count as one stack — an untargeted commit then silently lands on the stack's top branch, so pass-bwhenever the branch matters. -
Always pass
-m "<msg>"(or-F -with a heredoc,-F <file>with a file outside the repository, or--no-message) tobut commit, and tobut squashwhenever its sources are commits or branches unless the target is@(squash also takes-uto keep the target's message) — those compose a new message; without a flag an agent run keeps whatever the command composed (empty forbut commit, the joined source messages forbut squash) and a terminal opens an editor. Squash sources that are uncommitted or committed changes reuse the target's message and need no flag; squashing into@rejects message flags outright. -
Amend:
but amend -t <commit-or-branch> <file-or-hunk-id> <file-or-hunk-id>— a branch target resolves to its newest commit -
Uncommit:
but uncommit <commit-id>(whole commit),but uncommit <branch>(all commits and remove branch),but uncommit <commit-id>:<file-id>(committed file), orbut uncommit <commit-id>:<file-id>:<hunk-id>(committed hunk); committed files and hunks may be mixed, but all must come from one commit -
Copy commits (sources stay unchanged):
but pick <sha> [<sha>...] -b <new-branch>puts the copies on a new independent branch from the target,-b <existing-branch>on that applied branch's tip, and--above <branch> -b <new-name>(or--below) on a new branch stacked there. Pick applies sources in the order given, so pass them oldest first. For a branch that is not applied, list SHAs withgit log --reverse <target>..<branch>and inspect them withgit showorbut show <sha>;but diffand the IDs thatbut branch showprints for it do not work. -
Move committed changes into an existing commit or
@:but squash <commit-id>:<file-id> -t <commit-id-or-@>for a committed file;but squash <commit-id>:<file-id>:<hunk-id> -t <commit-id-or-@>for a committed hunk; all sources must come from one commit -
Move committed changes into a new commit at a chosen position:
but move <commit-id>:<file-id> --above <commit-or-branch> -m "<msg>"for a committed file;but move <commit-id>:<file-id>:<hunk-id> --above <commit-or-branch> -m "<msg>"for a committed hunk (--below,--branch, and--unstackalso work) -
but splitand abut moveof committed changes name their new commit with-mor-Ftoo; without either the commit gets an empty message.but moverejects-m/-Ffor whole-commit and branch sources. -
Move commit to branch top:
but move <commit-id> -b <branch> -
Move commits or committed changes onto a new named branch:
but move <source> --above <branch> -b <new-name>(--belowalso works); usebut move <source> --unstack -b <new-name>for an independent branch. Omit-bfor a generated name. Naming is not supported when stacking or unstacking a branch source. -
Discard:
but discard <id> [<id>...]— accepts branches, commits, committed changes, uncommitted changes, or@for all uncommitted changes -
Push:
but push <top-branch>— pushes the selected branch and its ancestors; to update a stack, select its top branch once and never loop. Barebut pushpushes all unpushed work when run non-interactively — one push per stack (its topmost unpushed branch, ancestors included), and the output lists every branch it pushed. It exits non-zero if any stack failed; stacks that already pushed stay pushed, and rerunning after fixing the failure is safe (up-to-date stacks are skipped).but pushandbut pr newreplace the remote branch: if others may have pushed to it, bring their commits in first (see Bring in commits pushed to a branch's own remote). -
Create PR:
but pr new <branch-name> [-m "Title..."] [-F - | -F <file>] [-t] [--draft]— auto-pushes first; do not runbut pushbefore it
Task Recipes
Update workspace from main
For "get latest from main", "update/sync this workspace", "rebase onto main", or "pull main":
but pull— one command; no preflight needed. Its output reports the resulting state, andbut undoreverts it. Uncommitted changes that conflict with the update get conflict markers and show as{conflicted}; resolve them as in Conflicts in uncommitted files.- If commits come back conflicted, resolve them with the
but resolve conflicts <branch>andbut resolve applyloop in Resolve conflicted commits, one branch at a time. WhenHEADisgitbutler/workspace,but pullprintsbut resolve <commit>as the next step; that is edit mode, which is only for running code against a resolution.
but pull --check answers "would this conflict?" without updating. Do not use
it as a routine preflight; use it when the user asks for a preview, you need a
fetch, repository policy requires one, other agents' branches may move, or an
applied branch was just merged upstream (see rule 3).
Rebasing applied branches onto the latest target IS but pull — never move,
config target, unapply, or raw git pull/git rebase. The base shown in
status is the last FETCHED state: when git log shows the remote target (for
example origin/main) ahead of it, that is exactly the update but pull
fetches and applies — the target setting is not stale and repointing it is never
the fix. Pull carries uncommitted changes along; there is no stash, so do not
hand-revert files.
Bring in commits pushed to a branch's own remote
but pull only rebases onto the target. Commits someone pushed to your branch's
remote show in but status under (upstream: on <remote>/<branch>), above the
branch's own commits; if status may be stale, run but pull --check to fetch.
but branch update <branch>, once, on the branch they pushed to.- Then
but pullif the target moved too. Update before pulling. If the branch was rebased since its last push (for example by an earlierbut pull), the update leaves an empty(no changes)copy of a shared commit. On a single branch,but discardthat copy by its#Nref. In a stack,but undothe update and tell the user, because the update can also move commits into the lower branch. Do not update a second time, even if(upstream: …)still lists commits, because a second update duplicates commits.
Commit selected files or hunks
but diff— shows file and hunk IDs for uncommitted changes. Do not run plainbut statusfirst.- Use file IDs when whole files belong in the commit; use hunk IDs
(
<file-id>:<hunk-id>) when only part of a file belongs. Omit IDs you don't want committed. For whole files, repo-root paths or adir/prefix work too (but commit -b feat -m "msg" src/ui/ README.md; no./or globs), so don't build ID lists by pipingbut diffthrough grep. but commit -b <branch> -m "<msg>" <id1> <id2>— the branch is created if it does not exist, so no priorbut branch newis needed.- When the task requires knowing which changes remain, add
--status-after; otherwise the created-commit result is sufficient.
Edge case: if wanted and unwanted edits are in the same diff hunk, GitButler cannot split that hunk by ID. Only when the task requires keeping part of that hunk uncommitted, temporarily edit the working tree to isolate the wanted lines, commit those IDs, then restore the leftover lines so they remain uncommitted.
Amend into existing commit
but status -fvfor the target commit ID and file IDs;but difffor hunk IDs when only part of a file belongs.but amend -t <commit-id> <id> <id>— one command per target commit. For several target commits, chain the amends with&&when every target is a change-ID ref; otherwise run them one at a time with--status-afterto get fresh refs.
Split an existing commit
For a two-way split, move selected committed files or hunks directly into a new commit:
but diff <source-commit-id>— read committed file and hunk IDs.but split <committed-file-or-hunk-id> [<committed-file-or-hunk-id>...] -m "<message>"— sources may mix files and hunks, but must come from one commit. The command creates the named commit immediately above the source and leaves unselected changes and the original message in the source. No follow-up reword is needed for the new commit.- Add
--status-afteronly when the next step needs workspace IDs or details not provided by the mutation result.
For more than two replacement commits, repeat but split ... -m "<message>"
using the remaining source's committed changes, or use the uncommit/recommit
workflow below when rebuilding the entire commit:
but status -fvwhen you need the source commit, branch name, or placement anchor.but uncommit <source-commit-id> && but diffin one shell call exposes the commit's changes and prints the resulting file and hunk IDs.- Pick replacement contents from that dirty diff, not from the old committed diff.
- Determine the requested chronological order from the user's wording, then
create the replacement commits oldest-first by chaining
but commitcalls. Do not reverse that order to matchbut status, which displays commits newest-first.-b <branch>puts each new commit at the TOP of that branch — if the split commit had commits above it, the replacements now sit above those preserved commits. - If commits from that branch must stay ABOVE the replacements, put the
preserved block back on top instead of fighting anchors. Do not anchor with
--above <top>/--below <top>(sha/#Nanchors go stale as each insert rewrites history). Move the block together so its internal order stays intact: append&& but move <preserved-id> [<preserved-id>...] -b <branch>to the commit chain. Change-ID refs from step 1 stay valid; wait for fresh output first if any preserved ref is sha-based or#N-suffixed. - Leave unwanted changes uncommitted. Replacements created oldest-first appear
newest-first in status — that is correct; do not reorder them. Add
--status-afterto the final mutation when you need to inspect the resulting order.
Reorder commits
but status displays commits newest/top first, while task specs often list
history oldest to newest — translate before moving.
but statusonce to get commit IDs (use-fvonly if you also need file details).but move <source> --below <target-commit>places source immediately below target inbut status(older in oldest-to-newest history).--aboveplaces it immediately above (newer).but move <source> -b <branch>moves it to branch top/newest.- For an adjacent block, run ONE move, anchored either way:
but move <block-id> <block-id> --below <following-commit-id>orbut move <block-id> <block-id> --above <preceding-commit-id>. Pick an anchor outside the block; source order does not matter and the block keeps its internal order. Add--status-afterwhen you need to inspect the resulting order; do not move the anchor or block members again. - For other reorders, make the smallest set of moves.
Squash commits
but statusfor commit IDs and order.- Name the sources positionally and the result/target commit with
-t:but squash <source> [<source>...] -t <target> -m "<new message>". - To collapse an entire branch into one commit, pass just the branch and no
-t:but squash <branch> -m "<new message>". - Multiple independent groups may run in sequence off one status read (targets
keep their change-ID refs); prefer newer/top groups first. Take fresh refs
only when a ref is sha-based or
#N-suffixed. - Add
--status-afterto the final squash when you need to inspect the resulting history; do not re-verify with a separate status.
Stack existing branches
To make one existing branch depend on another:
but move <child-branch-name> --above <parent-branch-name> (use full branch
names; commit reordering uses commit IDs). To unstack:
but move <branch-name> --unstack.
DO NOT stack via uncommit + branch delete + branch new --above, and do
not use but undo to unstack.
Work in a linked worktree
but worktree new <branch-name>checks out that branch in a new directory, creating it if needed (an existing branch must not be in the workspace), and prints that directory. Add-A <branch-or-commit>to start the branch there instead of the workspace base; it takes any Git revision, like a SHA ororigin/main. Worktrees made by other tools must sit outside the repository directory or be listed in.git/info/exclude; otherwise a barebut commitin the main checkout records them in the branch.- Run
butfrom that directory, or withbut -C <path>. There, a barebut commit -m "<msg>"orbut difftakes that worktree's changes, a bare path names a file there, and the commit goes on the worktree's branch. Do the work on that branch, also in a worktree another tool made.-b <new-name>is refused there, except in a worktree with a detached HEAD, where it names the worktree's branch; stack a new branch on it only when the user asks for a separate branch.but undodoesn't restore a branch a worktree has checked out. It refuses, or it reports success and leaves that branch as it is, so undoing amoveout of the branch leaves the commit on neither branch. Reverse a command that changed the worktree's branch with its inverse (uncommit,reword, ormovethe commit back), also when you ran it from another checkout. but statusfrom any checkout shows the worktree as a lane of its own, with the same IDs everywhere.@always means the main worktree's uncommitted changes;<worktree>:@names a linked worktree's changes from anywhere.- Push and open PRs as for any branch (
but pr new <branch-name>).but pullalso rebases worktree branches. If that leaves a worktree commit{conflicted}, the branch name doesn't find it: take its commit ID frombut statusand runbut resolve conflicts <commit-id>, thenbut resolve apply <path>:<N> --commit <commit-id>. Each apply rewrites the commit: refresh SHA-based or#N-suffixed IDs frombut status -fvbefore the next conflict query or apply; do not reuse a stale target. - When done,
but worktree remove <name>deletes the directory and keeps the branch. It refuses while the worktree has uncommitted changes;-fdiscards them. To delete the branch as well, runbut branch delete <name>afterwards.
Create or manage pull requests
but pr new <branch-name> pushes the selected branch and its ancestors, then
creates the PR in one step — no prior but push. Provide -F - with a heredoc
or -F <file> (first line is the title), -t, or -m with real newlines
(zsh/bash: -m $'Title\n\nBody') so no editor opens. Do not write the message
to a file inside the repository: the next but commit would commit it. If forge
auth is missing, ask the user to run but config forge auth in a terminal; it
refuses non-interactive runs.
If you do create a PR for a stacked branch, use but pr — not gh pr create
(only but pr sets PR bases and stack metadata; gh pr create breaks that). To
publish a whole stack: but pr new <top-branch-name> -t. Manage with
but pr auto-merge|set-draft|set-ready <selector>; selectors can be a branch
name, current branch/stack CLI ID, or numeric review ID. See
but skill reference for details.
When but pr new prints a <pr-created> line, copy that line into the text of
your reply. It tells the app running you that this session opened the PR.
If you run in the Claude desktop app, end the but pr new line with the shell
comment # gh pr create, for example
but pr new <branch-name> -F - <<'EOF' # gh pr create. While
gitbutler/workspace is checked out, the app counts a PR as opened by this
session only when the command text contains gh pr create.
Dependency conflict with another branch
Changes that build on another branch's commits cannot land on an independent
branch. but commit and but amend fail atomically ("Cannot commit: N changes
could not be applied"), naming the branch and commit each rejected change
depends on — nothing is committed and no -b branch is created.
Stack only when your change builds on that branch's code. A refusal can also mean your hunk only borders lines that branch changed (a doc line, a lockfile): then leave one unchanged line between your edit and theirs, or keep that hunk uncommitted until that branch lands, and commit the rest. Never drop or rewrite real work to get past a refusal; ask the user.
When there is a single dependency branch, the error's Hint gives the exact
recovery command: but move <your-branch> --above <dependency-branch> to stack
an existing branch on its dependency, or
but branch new <name> --above <dependency-branch> when the target branch
didn't exist yet. Run it, then retry the original command. When the error names
dependencies without a Hint (several dependency branches, or the dependency is
on the target branch itself), run but status -fv to see where the dependent
commits live before choosing a placement.
If that recovery command fails, do NOT try uncommit, squash, or undo as a
workaround — re-run but status -fv to confirm both branches exist and are
applied, then retry with exact branch names.
Resolve conflicted commits (after pull, move, or reorder)
NEVER use git add, git commit, git checkout --theirs/--ours, or any git
write command during resolution. Only but resolve commands plus direct file
edits. The one exception is a conflicted submodule in edit mode, below.
Conflicts do not interrupt operations in GitButler: a rebase always completes,
and commits that conflicted are marked {conflicted} in but status. Find them
from the warning that history-editing commands (move, discard, …) print,
from the but pull summary, or from but status. Resolve them one conflict at
a time, without entering any mode. Resolve any uncommitted {conflicted} files
first, as in Conflicts in uncommitted files; apply refuses while one is left.
Work through one branch at a time, oldest commit first — the loop is:
but resolve conflicts <branch>— shows the conflicts of that branch's oldest conflicted commit, numbered per file. Each conflict has three sections:ours(the new base the commit was rebased onto),base(common ancestor), andtheirs(the commit's own version). Without a branch it picks the first conflicted branch and tells you which; the output also says when other conflicted commits exist.- Apply one resolution per command:
- Merged/mixed content (the common case — combine the intent of both sides):
pipe it to
but resolve apply <path>:<N>via stdin (heredoc) or pass--file <f>. The content replaces the whole conflicted region; never include conflict markers. - Take a side entirely:
but resolve apply <path>:<N> --oursor--theirs(bare<path>applies the side to all conflicts in that file). - Delegate one conflict to the configured AI model:
but resolve apply <path>:<N> --ai— prefer your own merged content when you have the context. applytargets the same default commit asconflicts; when more than one branch is conflicted, pin it with--commit <branch>.
- Merged/mixed content (the common case — combine the intent of both sides):
pipe it to
- Go back to step 1 until it reports no conflicts. Commit ids are not stable
here — every apply rewrites the commit — but branch names are, so address
everything by branch and never bookkeep commit ids. Partial progress is fine:
a commit with unresolved conflicts left stays
{conflicted}with exactly those conflicts.
A wrong resolution is reverted with but undo.
but resolve <commit-id> --ai resolves a whole commit with the configured AI
model in one shot, and but resolve --ai without a commit resolves every
conflicted commit, oldest first — acceptable as a fallback, but you usually have
better context than that model does, so prefer resolving the conflicts yourself
with apply.
Use edit mode only when you must run code against the resolution
(build/tests at that commit). Edit mode needs gitbutler/workspace: while a
single branch is checked out, but resolve <commit-id> refuses, so use apply.
but resolve <commit-id>— enters resolution mode and prints the conflict regions.- Edit the files to remove every conflict marker —
<<<<<<<,|||||||(the common-ancestor section),=======and>>>>>>>— and keep the correct content. Do NOT skip this; do NOT usebut amendon conflicted commits.- A conflicted submodule has no markers and
finishrefuses until you select its side: see Conflict Resolution Mode inbut skill concepts.
- A conflicted submodule has no markers and
but resolve finishreports leftover markers, surviving uncommitted changes, every remaining conflicted commit, and the exact currentbut resolve <id>command. Add--status-afterto the finish you expect to clear the last conflict only when the task needs the complete resulting workspace. When it says no conflicted commits remain, stop; do not run a verification status. Cancel instead withbut resolve cancel --force, which drops your resolution edits; without--forceit refuses once the conflict markers are checked out.- Repeat for remaining conflicted commits, oldest first — finishing a lower commit rebases the ones above it.
A conflicted applied stack can block unrelated mutations
If a mutation reports Failed to merge bases while cherry picking commit while
another applied commit is conflicted, inspect the workspace-wide graph before
blaming the selected changes. Do not retry unrelated mutations while that
conflict remains unresolved. Preserve the conflicted commit and its order.
Recovery must be independently authorized. Use the existing conflict-resolution workflow, and consider a retry only after recovery and verification of a clean graph. Do not use raw Git to bypass the failure in a managed main worktree.
If the unrelated task already authorizes an existing linked/non-main worktree from a verified clean live head, use plain Git there and leave the affected GitButler workspace untouched. This does not authorize creating a worktree for isolation or resolving unrelated work.
Conflicts in uncommitted files
but status marks uncommitted files with unresolved merge conflicts
{conflicted}; they are excluded from committable changes and outside
but resolve mode. Edit the file to the wanted contents with no conflict
markers left (or delete it), then but resolve <path>... to mark it resolved
with that state; it then shows as an ordinary uncommitted change.
Git-to-But Map
| git | but |
|---|---|
git status |
but status for branch/stack/commit overview; but status -fv for file details; but diff for selected dirty changes |
git add + git commit |
but commit -b <branch> -m ... <ids> |
git checkout -b + commit |
but commit -b <new-branch> -m ... <ids> |
git push |
but push <branch-name> |
git rebase -i |
but move, but squash, but reword |
git rebase --onto |
but move <branch> --above <new-base> |
git checkout -- <file> / git restore |
but discard <path>, or a hunk ID from but diff |
git cherry-pick |
but pick |
git fetch |
but pull --check (fetches; changes no branch) |
git pull on a branch others pushed to |
but branch update <branch>, then but pull |
git worktree add -b <branch> |
but worktree new <branch> |
git worktree remove |
but worktree remove <name> |
gh pr create |
but pr new <branch-name> -m "Title..." |
Notes
butneeds no setup in a Git repository.HEADis either one checked-out branch, marked[HEAD]inbut status, orgitbutler/workspace, which merges every applied stack. Applying a second stack, or applying a branch while the target branch is checked out, switches togitbutler/workspace; unapplying back to one stack checks that branch out again. Commands and IDs are the same either way. It does need a local branch tracking the remote's default branch: if commands fail with "No target branch is configured", runbut config target origin/main(with the default branch's name), which createsmainto track it if missing. Nevergit branch --set-upstream-toon your own branch, which makes that branch the target.but undorestores the whole snapshot, so uncommitted edits made after the undone operation are lost (but redobrings them back).- Read-only git inspection (
git log,git blame,git show --stat) is allowed. - If
butprints anAGENT ACTION REQUIREDskill warning, run the suggested command once, then reload/use the GitButler skill. If it repeats, report it instead of retrying. - For command syntax and flags:
but skill reference - For workspace model:
but skill concepts - For workflow examples:
but skill examples
04 同仓库更多 Skills
worktree
Manage worktrees only for concurrent work by the owner or agents launched by the owner on the same repository, or for explicitly requested inventory and cleanup; never create one for isolation alone.
unslop
Rewrite draft prose before owner-facing replies, docs, issues, PR text, handoffs, or Telegram reports to remove AI tells while preserving facts, links, tone, and authority; auto-trigger on externally visible prose, but never on code, commands, logs, tool output, quoted sources, or user text.
threat-model-first
Use at the START of a change that moves money, changes balances or custody, touches access control or signing, deserializes untrusted input, adds an external or on-chain integration, or wires an LLM tool. Design-time threat modeling that turns abuse cases into the first failing tests; it precedes the post-hoc security-review pass.
test-inspector
Auto-run for new or changed retained behavior, even without test changes, and for test, fixture, snapshot or mock changes; verify real happy-path and error-path coverage, expose false-confidence assertions and over-mocking, but do not perform general production-code correctness review.
strong-typing-inspector
Lightweight review — flags primitives used where a domain type already exists (e.g. String for a USD field when Usd exists) and missed newtype opportunities.
spec-review
Critique existing specifications and design proposals, including whether their approach or addition is justified, and refine them through adversarial Pi review and authorized author revisions. Not for code review, implementation-plan sequencing, creating a design from scratch or minor copy edits.