opencode-gitbutler 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,504 @@
1
+ # GitButler CLI Command Reference
2
+
3
+ Comprehensive reference for all `but` commands.
4
+
5
+ ## Contents
6
+
7
+ - [Inspection](#inspection-understanding-state) - `status`, `show`, `diff`
8
+ - [Branching](#branching) - `branch new`, `apply`, `unapply`, `branch delete`, `pick`
9
+ - [Staging](#staging-multiple-staging-areas) - `stage`, `rub`
10
+ - [Committing](#committing) - `commit`, `absorb`
11
+ - [Editing History](#editing-history) - `rub`, `squash`, `amend`, `move`, `uncommit`, `reword`, `discard`
12
+ - [Conflict Resolution](#conflict-resolution) - `resolve`
13
+ - [Remote Operations](#remote-operations) - `push`, `pull`, `pr`, `merge`
14
+ - [Automation](#automation) - `mark`, `unmark`
15
+ - [History & Undo](#history--undo) - `undo`, `oplog`
16
+ - [Setup & Configuration](#setup--configuration) - `setup`, `teardown`, `config`, `gui`, `update`, `alias`
17
+ - [Global Options](#global-options)
18
+
19
+ ## Inspection (Understanding State)
20
+
21
+ ### `but status`
22
+
23
+ Overview of workspace state - this is your entry point.
24
+
25
+ ```bash
26
+ but status # Human-readable view
27
+ but status -f # File-centric view (shows which files in which commits)
28
+ but status --json # Structured output for parsing
29
+ but status --verbose # Detailed information
30
+ but status --upstream # Show upstream relationship
31
+ ```
32
+
33
+ Shows:
34
+
35
+ - Applied/unapplied branches in workspace
36
+ - Uncommitted changes (unstaged files)
37
+ - Commits on each stack
38
+ - CLI IDs to use in other commands
39
+
40
+ ### `but show <id>`
41
+
42
+ Details about a commit or branch.
43
+
44
+ ```bash
45
+ but show <id> # Show details
46
+ but show <id> --verbose # More detailed information
47
+ but show <id> --json # Structured output
48
+ ```
49
+
50
+ ### `but diff [target]`
51
+
52
+ Display diff for file, branch, stack, or commit.
53
+
54
+ ```bash
55
+ but diff <file-id> # Diff for specific file
56
+ but diff <branch-id> # Diff for all changes in branch
57
+ but diff <commit-id> # Diff for specific commit
58
+ but diff # Diff for entire workspace
59
+ but diff --json # JSON output with hunk IDs for `but commit --changes`
60
+ ```
61
+
62
+ ## Branching
63
+
64
+ ### `but branch`
65
+
66
+ List all branches (default when no subcommand).
67
+
68
+ ```bash
69
+ but branch # List branches
70
+ but branch --json # JSON output
71
+ ```
72
+
73
+ ### `but branch new <name>`
74
+
75
+ Create a new branch.
76
+
77
+ ```bash
78
+ but branch new feature # Independent branch (parallel work)
79
+ but branch new feature -a <anchor> # Stacked branch (dependent work)
80
+ ```
81
+
82
+ Use parallel branches for independent tasks. Use stacked branches when work depends on another branch.
83
+
84
+ ### `but apply <id>`
85
+
86
+ Activate a branch in the workspace.
87
+
88
+ ```bash
89
+ but apply <id> # Activate branch in workspace
90
+ ```
91
+
92
+ Applied branches are merged into `gitbutler/workspace` and visible in working directory.
93
+
94
+ ### `but unapply <id>`
95
+
96
+ Deactivate a branch from the workspace.
97
+
98
+ ```bash
99
+ but unapply <id> # Deactivate branch from workspace
100
+ ```
101
+
102
+ The identifier can be a CLI ID pointing to a stack or branch, or a branch name. If a branch is specified, the entire stack containing that branch will be unapplied.
103
+
104
+ ### `but branch delete <id>`
105
+
106
+ Delete a branch.
107
+
108
+ ```bash
109
+ but branch delete <id>
110
+ but branch -d <id> # Short form
111
+ ```
112
+
113
+ ### `but branch show <id>`
114
+
115
+ Show commits ahead of base for a branch.
116
+
117
+ ```bash
118
+ but branch show <id>
119
+ ```
120
+
121
+ ### `but pick <source> [target]`
122
+
123
+ Cherry-pick commits from unapplied branches into applied branches.
124
+
125
+ ```bash
126
+ but pick <commit-sha> <branch> # Pick specific commit into branch
127
+ but pick <cli-id> <branch> # Pick using CLI ID (e.g., "c5")
128
+ but pick <unapplied-branch> # Interactive commit selection from branch
129
+ but pick <commit-sha> # Auto-select target if only one branch
130
+ ```
131
+
132
+ The source can be:
133
+ - A commit SHA (full or short)
134
+ - A CLI ID from `but status`
135
+ - An unapplied branch name (shows interactive commit picker)
136
+
137
+ If no target is specified and multiple branches exist, prompts for selection interactively.
138
+
139
+ ## Staging (Multiple Staging Areas)
140
+
141
+ GitButler has multiple staging areas - one per stack.
142
+
143
+ ### `but stage <file> <branch>`
144
+
145
+ Stage file to a specific branch.
146
+
147
+ ```bash
148
+ but stage <file-id> <branch-id>
149
+ ```
150
+
151
+ Alias for `but rub <file> <branch>`. You can't stage changes that depend on branch A to branch B.
152
+
153
+ ### `but rub <file> <branch>`
154
+
155
+ Core primitive for staging (see Editing History for other `but rub` uses).
156
+
157
+ ```bash
158
+ but rub <file-id> <branch-id> # Stage file to branch
159
+ ```
160
+
161
+ ## Committing
162
+
163
+ ### `but commit [branch]`
164
+
165
+ Commit changes to a branch.
166
+
167
+ ```bash
168
+ but commit <branch> --only -m "message" # Commit ONLY staged changes (recommended)
169
+ but commit <branch> -m "message" # Commit ALL uncommitted changes to branch
170
+ but commit <branch> -m "message" --changes <id>,<id> # Commit specific files or hunks by CLI ID
171
+ but commit <branch> -i # AI-generated commit message
172
+ but commit empty --before <target> # Insert empty commit before target
173
+ but commit empty --after <target> # Insert empty commit after target
174
+ ```
175
+
176
+ **Important:** Without `--only`, ALL uncommitted changes are committed to the branch, not just staged files. Use `--only` when you've staged specific files and want to commit only those.
177
+
178
+ **Committing specific files or hunks:** Use `--changes` (or `-p`) with comma-separated CLI IDs to commit only those files or hunks:
179
+ - **File IDs** from `but status --json`: commits entire files
180
+ - **Hunk IDs** from `but diff --json`: commits individual hunks
181
+
182
+ **Note:** `--changes` and `--only` are mutually exclusive.
183
+
184
+ Example: `but commit my-branch -m "Fix bug" --changes ab,cd` commits files/hunks `ab` and `cd`.
185
+
186
+ To commit specific hunks from a file with multiple changes, use `but diff --json` to see hunk IDs, then specify them individually.
187
+
188
+ If only one branch is applied, you can omit the branch ID.
189
+
190
+ ### `but absorb [source]`
191
+
192
+ Automatically amend uncommitted changes into existing commits.
193
+
194
+ ```bash
195
+ but absorb <file-id> # Absorb specific file (recommended)
196
+ but absorb <branch-id> # Absorb all changes staged to this branch
197
+ but absorb # Absorb ALL uncommitted changes (use with caution)
198
+ but absorb --dry-run # Preview without making changes
199
+ but absorb <file-id> --dry-run # Preview specific file absorption
200
+ ```
201
+
202
+ **Recommendation:** Prefer targeted absorb (`but absorb <file-id>`) over absorbing everything. Running `but absorb` without arguments absorbs ALL uncommitted changes across all branches, which may not be what you want.
203
+
204
+ Logic:
205
+
206
+ - Changes amended into topmost commit of their branch
207
+ - Changes depending on specific commit amended into that commit
208
+ - Uses smart matching to find appropriate commits
209
+
210
+ ## Editing History
211
+
212
+ ### `but rub <source> <dest>`
213
+
214
+ Universal editing primitive that does different operations based on types.
215
+
216
+ ```bash
217
+ but rub <file> <branch> # Stage file to branch
218
+ but rub <file> <commit> # Amend file into commit
219
+ but rub <commit> <commit> # Squash commits together
220
+ but rub <commit> <branch> # Move commit to branch
221
+ ```
222
+
223
+ The core "rub two things together" operation.
224
+
225
+ ### `but squash <commits>`
226
+
227
+ Squash commits together.
228
+
229
+ ```bash
230
+ but squash <c1> <c2> <c3> # Squash multiple commits (into last)
231
+ but squash <c1>..<c4> # Squash a range
232
+ but squash <branch> # Squash all commits in branch into bottom-most
233
+ ```
234
+
235
+ ### `but amend <file> <commit>`
236
+
237
+ Amend file into a specific commit. Use when you know exactly which commit the change belongs to.
238
+
239
+ ```bash
240
+ but amend <file-id> <commit-id> # Amend file into specific commit
241
+ ```
242
+
243
+ **When to use `amend` vs `absorb`:**
244
+ - `but amend` - You know the target commit; explicit control
245
+ - `but absorb` - Let GitButler auto-detect the target; smart matching based on dependencies
246
+
247
+ Alias for `but rub <file> <commit>`.
248
+
249
+ ### `but move <commit> <target>`
250
+
251
+ Move a commit to a different location.
252
+
253
+ ```bash
254
+ but move <source> <target> # Move before target
255
+ but move <source> <target> --after # Move after target
256
+ but move <commit> <branch> # Move to top of branch
257
+ ```
258
+
259
+ ### `but uncommit <source>`
260
+
261
+ Uncommit changes back to unstaged area.
262
+
263
+ ```bash
264
+ but uncommit <commit-id> # Uncommit entire commit
265
+ but uncommit <file-id> # Uncommit specific file from its commit
266
+ ```
267
+
268
+ ### `but reword <id>`
269
+
270
+ Reword commit message or rename branch.
271
+
272
+ ```bash
273
+ but reword <id> # Interactive editor
274
+ but reword <id> -m "new" # Non-interactive
275
+ but reword <id> --format # Format to 72-char wrapping
276
+ ```
277
+
278
+ ### `but discard <id>`
279
+
280
+ Discard uncommitted changes.
281
+
282
+ ```bash
283
+ but discard <file-id> # Discard file changes
284
+ but discard <hunk-id> # Discard hunk changes
285
+ ```
286
+
287
+ ## Conflict Resolution
288
+
289
+ When commits have conflicts (shown in `but status`):
290
+
291
+ ### `but resolve <commit>`
292
+
293
+ Enter resolution mode for a conflicted commit.
294
+
295
+ ```bash
296
+ but resolve <commit-id>
297
+ ```
298
+
299
+ ### `but resolve status`
300
+
301
+ Show remaining conflicted files.
302
+
303
+ ```bash
304
+ but resolve status
305
+ ```
306
+
307
+ ### `but resolve finish`
308
+
309
+ Finalize conflict resolution.
310
+
311
+ ```bash
312
+ but resolve finish
313
+ ```
314
+
315
+ ### `but resolve cancel`
316
+
317
+ Cancel conflict resolution and return to workspace mode.
318
+
319
+ ```bash
320
+ but resolve cancel
321
+ ```
322
+
323
+ **Workflow:**
324
+
325
+ 1. `but resolve <commit>` - Enter mode
326
+ 2. Edit files to resolve conflicts
327
+ 3. `but resolve status` - Check progress
328
+ 4. `but resolve finish` - Complete
329
+
330
+ ## Remote Operations
331
+
332
+ ### `but push [branch]`
333
+
334
+ Push branches to remote.
335
+
336
+ ```bash
337
+ but push # Push all branches with unpushed commits
338
+ but push <branch-id> # Push specific branch
339
+ but push --dry-run # Preview what would be pushed
340
+ but push --with-force # Force push (use carefully!)
341
+ ```
342
+
343
+ ### `but pull`
344
+
345
+ Update all branches with target branch changes.
346
+
347
+ ```bash
348
+ but pull # Fetch and rebase all branches
349
+ but pull --check # Check if can merge cleanly (no changes)
350
+ ```
351
+
352
+ Run regularly to stay up to date with main development line.
353
+
354
+ ### `but pr`
355
+
356
+ Create and manage pull requests.
357
+
358
+ ```bash
359
+ but pr new <branch-id> # Push branch and create PR (recommended)
360
+ but pr new <branch-id> -F pr_message.txt # Use file: first line is title, rest is description
361
+ but pr new <branch-id> -m "Title..." # Inline message: first line is title, rest is description
362
+ but pr # Create PR (prompts for branch)
363
+ but pr template # Configure PR description template
364
+ ```
365
+
366
+ **Key behavior:** `but pr new` automatically pushes the branch to remote before creating the PR. No need to run `but push` first.
367
+
368
+ In non-interactive environments, use `--message (-m)`, `--file (-F)`, or `--default (-t)` to avoid editor prompts.
369
+
370
+ **Note:** For stacked branches, the custom message (`-m` or `-F`) only applies to the selected branch. Dependent branches in the stack will use default messages (commit title/description).
371
+
372
+ Requires forge integration to be configured via `but config forge auth`.
373
+
374
+ ### `but merge <branch>`
375
+
376
+ Merge branch into local target branch.
377
+
378
+ ```bash
379
+ but merge <branch-id>
380
+ ```
381
+
382
+ Merges into local target branch, then runs `but pull` to update.
383
+
384
+ ## Automation
385
+
386
+ ### `but mark <target>`
387
+
388
+ Auto-stage or auto-commit new changes.
389
+
390
+ ```bash
391
+ but mark <branch-id> # New unstaged changes auto-stage to this branch
392
+ but mark <commit-id> # New changes auto-amend into this commit
393
+ but mark <id> --delete # Remove the mark
394
+ ```
395
+
396
+ ### `but unmark`
397
+
398
+ Remove all marks.
399
+
400
+ ```bash
401
+ but unmark
402
+ ```
403
+
404
+ Use marks when working on a focused area to automatically organize changes.
405
+
406
+ ## History & Undo
407
+
408
+ ### `but undo`
409
+
410
+ Undo last operation.
411
+
412
+ ```bash
413
+ but undo
414
+ ```
415
+
416
+ Reverts to previous oplog snapshot.
417
+
418
+ ### `but oplog`
419
+
420
+ View operation history.
421
+
422
+ ```bash
423
+ but oplog
424
+ but oplog --json
425
+ ```
426
+
427
+ Shows all operations with snapshot IDs.
428
+
429
+ ### `but oplog restore <snapshot>`
430
+
431
+ Restore to a specific oplog snapshot.
432
+
433
+ ```bash
434
+ but oplog restore <snapshot-id>
435
+ ```
436
+
437
+ ## Setup & Configuration
438
+
439
+ ### `but setup`
440
+
441
+ Initialize GitButler in current git repository.
442
+
443
+ ```bash
444
+ but setup
445
+ ```
446
+
447
+ Converts regular git repo to use GitButler workspace model.
448
+
449
+ ### `but teardown`
450
+
451
+ Exit GitButler mode and return to normal git workflow.
452
+
453
+ ```bash
454
+ but teardown
455
+ ```
456
+
457
+ ### `but config`
458
+
459
+ View and manage GitButler configuration.
460
+
461
+ ```bash
462
+ but config
463
+ ```
464
+
465
+ ### `but gui`
466
+
467
+ Open GitButler GUI for current project.
468
+
469
+ ```bash
470
+ but gui
471
+ ```
472
+
473
+ ### `but update`
474
+
475
+ Manage GitButler CLI and app updates.
476
+
477
+ ```bash
478
+ but update
479
+ ```
480
+
481
+ ### `but alias`
482
+
483
+ Manage command aliases.
484
+
485
+ ```bash
486
+ but alias
487
+ ```
488
+
489
+ ## Global Options
490
+
491
+ Available on most commands:
492
+
493
+ - `-j, --json` - Output in JSON format for parsing
494
+ - `-C, --current-dir <PATH>` - Run as if started in different directory
495
+ - `-h, --help` - Show help for command
496
+
497
+ ## Getting More Help
498
+
499
+ ```bash
500
+ but --help # List all commands
501
+ but <subcommand> --help # Detailed help for specific command
502
+ ```
503
+
504
+ Full documentation: <https://docs.gitbutler.com/cli-overview>