type-git 0.0.1 → 0.0.2

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.
@@ -8,8 +8,48 @@ import type { ExecOpts, GitProgress, LfsMode, RawResult } from './types.js';
8
8
  export interface RepoBase {
9
9
  /**
10
10
  * Execute a raw git command in this repository context
11
+ *
12
+ * Wraps: `git <argv...>`
11
13
  */
12
14
  raw(argv: Array<string>, opts?: ExecOpts): Promise<RawResult>;
15
+ /**
16
+ * Check if this repository is a worktree repository (has working directory)
17
+ *
18
+ * Wraps: `git rev-parse --is-inside-work-tree`
19
+ *
20
+ * This is a runtime check that queries git to determine the repository type.
21
+ * Note: TypeScript cannot automatically narrow the type based on this check
22
+ * since it returns `Promise<boolean>`. Use type assertions after checking.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const repo = await git.openRaw('/path/to/repo');
27
+ * if (await repo.isWorktree()) {
28
+ * // Use type assertion to access WorktreeRepo methods
29
+ * const status = await (repo as WorktreeRepo).status();
30
+ * }
31
+ * ```
32
+ */
33
+ isWorktree(): Promise<boolean>;
34
+ /**
35
+ * Check if this repository is a bare repository (no working directory)
36
+ *
37
+ * Wraps: `git rev-parse --is-bare-repository`
38
+ *
39
+ * This is a runtime check that queries git to determine the repository type.
40
+ * Note: TypeScript cannot automatically narrow the type based on this check
41
+ * since it returns `Promise<boolean>`. Use type assertions after checking.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const repo = await git.openRaw('/path/to/repo');
46
+ * if (await repo.isBare()) {
47
+ * // Use type assertion to access BareRepo methods
48
+ * await (repo as BareRepo).fetch({ remote: 'origin' });
49
+ * }
50
+ * ```
51
+ */
52
+ isBare(): Promise<boolean>;
13
53
  }
14
54
  /**
15
55
  * Status file entry
@@ -34,8 +74,26 @@ export type StatusPorcelain = {
34
74
  * Options for git status
35
75
  */
36
76
  export type StatusOpts = {
77
+ /** Porcelain output format version (1 or 2) */
37
78
  porcelain?: 1 | 2;
79
+ /** How to show untracked files */
38
80
  untracked?: 'no' | 'normal' | 'all';
81
+ /** Give the output in verbose format */
82
+ verbose?: boolean;
83
+ /** Show stash information */
84
+ showStash?: boolean;
85
+ /** Compute ahead/behind counts for the branch */
86
+ aheadBehind?: boolean;
87
+ /** Use NUL as line terminator */
88
+ nullTerminated?: boolean;
89
+ /** How to show ignored files */
90
+ ignored?: 'traditional' | 'no' | 'matching';
91
+ /** How to handle submodules */
92
+ ignoreSubmodules?: 'none' | 'untracked' | 'dirty' | 'all';
93
+ /** Do not detect renames */
94
+ noRenames?: boolean;
95
+ /** Detect renames (optionally with similarity threshold) */
96
+ findRenames?: boolean | number;
39
97
  };
40
98
  /**
41
99
  * Commit information
@@ -61,25 +119,127 @@ export type Commit = {
61
119
  * Options for git log
62
120
  */
63
121
  export type LogOpts = {
122
+ /** Limit the number of commits to output */
64
123
  maxCount?: number;
124
+ /** Skip number of commits before starting to show the output */
65
125
  skip?: number;
126
+ /** Show commits more recent than a specific date */
66
127
  since?: string | Date;
128
+ /** Show commits older than a specific date */
67
129
  until?: string | Date;
130
+ /** Limit commits to those by a specific author */
68
131
  author?: string;
132
+ /** Limit commits to those with log message matching the pattern */
69
133
  grep?: string;
134
+ /** Pretend as if all refs are listed on the command line */
70
135
  all?: boolean;
71
136
  /** Follow only the first parent commit upon seeing a merge commit */
72
137
  firstParent?: boolean;
138
+ /** Print out the ref name given on the command line by which each commit was reached */
139
+ source?: boolean;
140
+ /** Use mailmap file to map author names */
141
+ useMailmap?: boolean;
142
+ /** If no --decorate-refs is given, pretend as if all refs were included */
143
+ decorateRefs?: string;
144
+ /** Do not include refs matching the pattern */
145
+ decorateRefsExclude?: string;
146
+ /** Print out the ref names of any commits that are shown */
147
+ decorate?: 'short' | 'full' | 'auto' | 'no';
148
+ /** Generate a diffstat */
149
+ stat?: boolean;
150
+ /** Output only the last line of the stat */
151
+ shortstat?: boolean;
152
+ /** Show only names of changed files */
153
+ nameOnly?: boolean;
154
+ /** Show only names and status of changed files */
155
+ nameStatus?: boolean;
156
+ /** Show only merge commits */
157
+ merges?: boolean;
158
+ /** Do not show merge commits */
159
+ noMerges?: boolean;
160
+ /** Only display commits that are ancestors of the specified commit */
161
+ ancestryPath?: boolean;
162
+ /** Output commits in reverse order */
163
+ reverse?: boolean;
164
+ /** Alias for since */
165
+ after?: string | Date;
166
+ /** Alias for until */
167
+ before?: string | Date;
168
+ /** Revision or revision range to show (e.g., 'main', 'HEAD~5..HEAD', 'v1.0.0') */
169
+ ref?: string;
73
170
  };
74
171
  /**
75
172
  * Options for git fetch
76
173
  */
77
174
  export type FetchOpts = {
175
+ /** Remote name to fetch from */
78
176
  remote?: string;
177
+ /** Refspec(s) to fetch */
79
178
  refspec?: string | Array<string>;
179
+ /** Remove remote-tracking refs that no longer exist on the remote */
80
180
  prune?: boolean;
181
+ /** Fetch all tags from the remote */
81
182
  tags?: boolean;
183
+ /** Limit fetching to the specified number of commits */
82
184
  depth?: number;
185
+ /** Be more verbose */
186
+ verbose?: boolean;
187
+ /** Operate quietly (suppress progress reporting) */
188
+ quiet?: boolean;
189
+ /** Fetch from all remotes */
190
+ all?: boolean;
191
+ /** Set upstream tracking for the fetched branches */
192
+ setUpstream?: boolean;
193
+ /** Append ref names and object names of fetched refs to .git/FETCH_HEAD */
194
+ append?: boolean;
195
+ /** Use atomic transaction to update refs */
196
+ atomic?: boolean;
197
+ /** Force update of local branches */
198
+ force?: boolean;
199
+ /** Allow fetching from multiple remotes */
200
+ multiple?: boolean;
201
+ /** Do not fetch any tags */
202
+ noTags?: boolean;
203
+ /** Number of parallel children for fetching submodules */
204
+ jobs?: number;
205
+ /** Modify the configured refspec to place all refs into refs/prefetch/ */
206
+ prefetch?: boolean;
207
+ /** Also prune tags that are no longer on the remote */
208
+ pruneTags?: boolean;
209
+ /** Fetch submodules recursively */
210
+ recurseSubmodules?: boolean | 'yes' | 'on-demand' | 'no';
211
+ /** Dry run - show what would be done without making changes */
212
+ dryRun?: boolean;
213
+ /** Allow updating FETCH_HEAD */
214
+ writeFetchHead?: boolean;
215
+ /** Keep downloaded pack */
216
+ keep?: boolean;
217
+ /** Allow updating the current branch head */
218
+ updateHeadOk?: boolean;
219
+ /** Deepen a shallow repository by date */
220
+ shallowSince?: string | Date;
221
+ /** Deepen a shallow repository excluding specified revision */
222
+ shallowExclude?: string | Array<string>;
223
+ /** Deepen a shallow repository by specified number of commits */
224
+ deepen?: number;
225
+ /** Convert a shallow repository to a complete one */
226
+ unshallow?: boolean;
227
+ /** Re-fetch all objects even if we already have them */
228
+ refetch?: boolean;
229
+ /** Update shallow boundary if new refs need it */
230
+ updateShallow?: boolean;
231
+ /** Override the default refspec */
232
+ refmap?: string;
233
+ /** Use IPv4 addresses only */
234
+ ipv4?: boolean;
235
+ /** Use IPv6 addresses only */
236
+ ipv6?: boolean;
237
+ /** Partial clone filter specification */
238
+ filter?: string;
239
+ /** Check for forced updates */
240
+ showForcedUpdates?: boolean;
241
+ /** Write commit graph after fetching */
242
+ writeCommitGraph?: boolean;
83
243
  };
84
244
  /**
85
245
  * Force with lease options for git push
@@ -94,8 +254,11 @@ export type ForceWithLeaseOpts = {
94
254
  * Options for git push
95
255
  */
96
256
  export type PushOpts = {
257
+ /** Remote name to push to */
97
258
  remote?: string;
259
+ /** Refspec(s) to push */
98
260
  refspec?: string | Array<string>;
261
+ /** Force updates even if they are not fast-forward */
99
262
  force?: boolean;
100
263
  /**
101
264
  * Force with lease - safer force push that fails if remote has been updated
@@ -103,7 +266,9 @@ export type PushOpts = {
103
266
  * - ForceWithLeaseOpts: specify refname and optional expected value
104
267
  */
105
268
  forceWithLease?: boolean | ForceWithLeaseOpts;
269
+ /** Push all tags */
106
270
  tags?: boolean;
271
+ /** Set upstream tracking for the pushed branches */
107
272
  setUpstream?: boolean;
108
273
  /** Bypass pre-push hook */
109
274
  noVerify?: boolean;
@@ -113,6 +278,40 @@ export type PushOpts = {
113
278
  * - 'if-asked': sign only if server supports and requests it
114
279
  */
115
280
  signed?: boolean | 'if-asked';
281
+ /** Be more verbose */
282
+ verbose?: boolean;
283
+ /** Operate quietly (suppress progress reporting) */
284
+ quiet?: boolean;
285
+ /** Override the default repository */
286
+ repo?: string;
287
+ /** Push all branches */
288
+ all?: boolean;
289
+ /** Push all branches (alias for all) */
290
+ branches?: boolean;
291
+ /** Mirror mode - push all refs */
292
+ mirror?: boolean;
293
+ /** Delete the specified refs from the remote */
294
+ deleteRefs?: boolean;
295
+ /** Dry run - show what would be pushed without pushing */
296
+ dryRun?: boolean;
297
+ /** Force only if the remote tip is included in local history */
298
+ forceIfIncludes?: boolean;
299
+ /** Push submodules recursively */
300
+ recurseSubmodules?: 'check' | 'on-demand' | 'only' | 'no';
301
+ /** Use thin pack transfer */
302
+ thin?: boolean;
303
+ /** Prune remote-tracking branches that are deleted locally */
304
+ prune?: boolean;
305
+ /** Push all refs under refs/tags with the commits */
306
+ followTags?: boolean;
307
+ /** Use atomic transaction to update refs */
308
+ atomic?: boolean;
309
+ /** Transmit push options to the server */
310
+ pushOption?: string | Array<string>;
311
+ /** Use IPv4 addresses only */
312
+ ipv4?: boolean;
313
+ /** Use IPv6 addresses only */
314
+ ipv6?: boolean;
116
315
  };
117
316
  /**
118
317
  * Options for git add
@@ -130,6 +329,26 @@ export type AddOpts = {
130
329
  interactive?: never;
131
330
  /** Add changes in patch mode (not supported - use raw) */
132
331
  patch?: never;
332
+ /** Be verbose */
333
+ verbose?: boolean;
334
+ /** Record only the fact that the path will be added later */
335
+ intentToAdd?: boolean;
336
+ /** Apply the clean process freshly to all tracked files */
337
+ renormalize?: boolean;
338
+ /** Ignore removal of files from working tree */
339
+ ignoreRemoval?: boolean;
340
+ /** Don't add files, just refresh their stat info in the index */
341
+ refresh?: boolean;
342
+ /** If some files could not be added, continue adding others */
343
+ ignoreErrors?: boolean;
344
+ /** Don't report missing files (with --dry-run) */
345
+ ignoreMissing?: boolean;
346
+ /** Allow updating index entries outside of sparse-checkout cone */
347
+ sparse?: boolean;
348
+ /** Override the executable bit of the listed files */
349
+ chmod?: '+x' | '-x';
350
+ /** Read pathspecs from file instead of command line */
351
+ pathspecFromFile?: string;
133
352
  };
134
353
  /**
135
354
  * Branch information
@@ -151,6 +370,24 @@ export type BranchOpts = {
151
370
  remotes?: boolean;
152
371
  /** Show verbose info */
153
372
  verbose?: boolean;
373
+ /** Suppress informational messages */
374
+ quiet?: boolean;
375
+ /** Only list branches that contain the specified commit */
376
+ contains?: string;
377
+ /** Only list branches that don't contain the specified commit */
378
+ noContains?: string;
379
+ /** Abbreviate object names to specified length */
380
+ abbrev?: number;
381
+ /** Only list branches whose tips are reachable from the specified commit */
382
+ merged?: string;
383
+ /** Only list branches whose tips are not reachable from the specified commit */
384
+ noMerged?: string;
385
+ /** Sorting key (e.g., -committerdate, refname) */
386
+ sort?: string;
387
+ /** Only list branches that point at the specified object */
388
+ pointsAt?: string;
389
+ /** Sorting and filtering are case insensitive */
390
+ ignoreCase?: boolean;
154
391
  };
155
392
  /**
156
393
  * Options for creating a branch
@@ -162,6 +399,12 @@ export type BranchCreateOpts = {
162
399
  force?: boolean;
163
400
  /** Set up tracking */
164
401
  track?: boolean;
402
+ /** Set up upstream configuration for the new branch */
403
+ setUpstreamTo?: string;
404
+ /** Create the branch's reflog */
405
+ createReflog?: boolean;
406
+ /** Also update submodules */
407
+ recurseSubmodules?: boolean;
165
408
  };
166
409
  /**
167
410
  * Options for deleting a branch
@@ -173,9 +416,11 @@ export type BranchDeleteOpts = {
173
416
  remote?: boolean;
174
417
  };
175
418
  /**
176
- * Options for git checkout
419
+ * Options for git checkout (branch switching mode)
420
+ *
421
+ * Used for: `git checkout <branch>`
177
422
  */
178
- export type CheckoutOpts = {
423
+ export type CheckoutBranchOpts = {
179
424
  /** Force checkout (discard local changes) */
180
425
  force?: boolean;
181
426
  /** Create new branch */
@@ -184,7 +429,55 @@ export type CheckoutOpts = {
184
429
  startPoint?: string;
185
430
  /** Track remote branch */
186
431
  track?: boolean;
432
+ /** Create or reset and checkout branch (like -b but forces) */
433
+ forceCreateBranch?: boolean;
434
+ /** Create reflog for new branch */
435
+ createReflog?: boolean;
436
+ /** Try to guess remote tracking branch if target not found */
437
+ guess?: boolean;
438
+ /** Suppress progress reporting */
439
+ quiet?: boolean;
440
+ /** Update submodules */
441
+ recurseSubmodules?: boolean;
442
+ /** Merge local modifications with the new branch */
443
+ merge?: boolean;
444
+ /** Conflict style for merge conflicts */
445
+ conflict?: 'merge' | 'diff3' | 'zdiff3';
446
+ /** Detach HEAD at specified commit */
447
+ detach?: boolean;
448
+ /** Create new orphan branch */
449
+ orphan?: boolean;
450
+ /** Silently overwrite ignored files */
451
+ overwriteIgnore?: boolean;
452
+ /** Ignore if branch is checked out in other worktrees */
453
+ ignoreOtherWorktrees?: boolean;
454
+ };
455
+ /**
456
+ * Options for git checkout (pathspec mode)
457
+ *
458
+ * Used for: `git checkout [<tree-ish>] -- <pathspec>...`
459
+ */
460
+ export type CheckoutPathOpts = {
461
+ /** Force checkout (discard local changes) */
462
+ force?: boolean;
463
+ /** Source tree-ish to checkout from (default: index) */
464
+ source?: string;
465
+ /** Suppress progress reporting */
466
+ quiet?: boolean;
467
+ /** Allow overlapping paths when checking out from tree-ish */
468
+ overlay?: boolean;
469
+ /** Check out 'our' version for unmerged files */
470
+ ours?: boolean;
471
+ /** Check out 'their' version for unmerged files */
472
+ theirs?: boolean;
473
+ /** Read pathspecs from file instead of command line */
474
+ pathspecFromFile?: string;
187
475
  };
476
+ /**
477
+ * Options for git checkout (legacy combined type)
478
+ * @deprecated Use CheckoutBranchOpts or CheckoutPathOpts for type safety
479
+ */
480
+ export type CheckoutOpts = CheckoutBranchOpts & CheckoutPathOpts;
188
481
  /**
189
482
  * Options for git commit
190
483
  */
@@ -209,6 +502,40 @@ export type CommitOpts = {
209
502
  gpgSign?: boolean;
210
503
  /** Do not GPG-sign the commit (override commit.gpgSign config) */
211
504
  noGpgSign?: boolean;
505
+ /** Suppress commit summary message */
506
+ quiet?: boolean;
507
+ /** Show unified diff between HEAD and working tree */
508
+ verbose?: boolean;
509
+ /** Read commit message from file */
510
+ file?: string;
511
+ /** Take existing commit message and re-edit it */
512
+ reeditMessage?: string;
513
+ /** Take existing commit message and reuse it */
514
+ reuseMessage?: string;
515
+ /** Create a fixup commit for the specified commit */
516
+ fixup?: string;
517
+ /** Create a squash commit for the specified commit */
518
+ squash?: string;
519
+ /** Override author date and ignore cached author identity */
520
+ resetAuthor?: boolean;
521
+ /** Add trailers to the commit message */
522
+ trailer?: string | Array<string>;
523
+ /** Add Signed-off-by trailer */
524
+ signoff?: boolean;
525
+ /** How to clean up the commit message */
526
+ cleanup?: 'strip' | 'whitespace' | 'verbatim' | 'scissors' | 'default';
527
+ /** Before committing, also stage specified paths */
528
+ include?: boolean;
529
+ /** Commit only specified paths, ignoring staged changes */
530
+ only?: boolean;
531
+ /** Bypass post-rewrite hook */
532
+ noPostRewrite?: boolean;
533
+ /** How to show untracked files */
534
+ untrackedFiles?: 'no' | 'normal' | 'all';
535
+ /** Read pathspecs from file instead of command line */
536
+ pathspecFromFile?: string;
537
+ /** Allow commit with empty message */
538
+ allowEmptyMessage?: boolean;
212
539
  };
213
540
  /**
214
541
  * Commit result
@@ -245,6 +572,44 @@ export type DiffOpts = {
245
572
  ignoreWhitespace?: boolean;
246
573
  /** Pathspecs to filter */
247
574
  paths?: Array<string>;
575
+ /** Use NUL as line terminator */
576
+ nullTerminated?: boolean;
577
+ /** Generate patch output */
578
+ patch?: boolean;
579
+ /** Generate patch and raw format together */
580
+ patchWithRaw?: boolean;
581
+ /** Show number of added/deleted lines in decimal notation */
582
+ numstat?: boolean;
583
+ /** Generate patch and diffstat together */
584
+ patchWithStat?: boolean;
585
+ /** Show full 40-byte hexadecimal object name in diff */
586
+ fullIndex?: boolean;
587
+ /** Abbreviate object names to specified length */
588
+ abbrev?: number;
589
+ /** Swap two inputs (show reverse diff) */
590
+ reverse?: boolean;
591
+ /** Detect rewrites (optionally with threshold like '50%') */
592
+ detectRewrites?: boolean | string;
593
+ /** Detect renames (optionally with threshold like '50%') */
594
+ detectRenames?: boolean | string;
595
+ /** Detect copies (optionally with threshold like '50%') */
596
+ detectCopies?: boolean | string;
597
+ /** Find copies harder (inspects unmodified files as source) */
598
+ findCopiesHarder?: boolean;
599
+ /** Rename limit threshold */
600
+ renameLimit?: number;
601
+ /** Look for string added/removed in a change (pickaxe) */
602
+ pickaxe?: string;
603
+ /** Show all files that changed, not just those with pickaxe match */
604
+ pickaxeAll?: boolean;
605
+ /** Treat all files as text */
606
+ text?: boolean;
607
+ /** Show changes relative to a merge base */
608
+ mergeBase?: string;
609
+ /** Compare two paths on filesystem (not in repository) */
610
+ noIndex?: boolean;
611
+ /** Show word diff */
612
+ wordDiff?: 'color' | 'plain' | 'porcelain' | 'none';
248
613
  };
249
614
  /**
250
615
  * Diff file entry
@@ -285,6 +650,38 @@ export type MergeOpts = {
285
650
  continue?: boolean;
286
651
  /** Bypass pre-merge-commit hook */
287
652
  noVerify?: boolean;
653
+ /** Do not show diffstat at end of merge */
654
+ noDiffstat?: boolean;
655
+ /** Show diffstat at end of merge */
656
+ stat?: boolean;
657
+ /** Show compact summary of changed files */
658
+ compactSummary?: boolean;
659
+ /** Add log of commits being merged (optionally with count) */
660
+ log?: boolean | number;
661
+ /** How to clean up the commit message */
662
+ cleanup?: 'strip' | 'whitespace' | 'verbatim' | 'scissors' | 'default';
663
+ /** Automatically update rerere state */
664
+ rerereAutoupdate?: boolean;
665
+ /** Verify that commit is signed with a valid key */
666
+ verifySignatures?: boolean;
667
+ /** Be verbose */
668
+ verbose?: boolean;
669
+ /** Be quiet */
670
+ quiet?: boolean;
671
+ /** Quit the current in-progress merge without cleanup */
672
+ quit?: boolean;
673
+ /** Allow merging histories that do not share a common ancestor */
674
+ allowUnrelatedHistories?: boolean;
675
+ /** GPG-sign the merge commit (optionally with key id) */
676
+ gpgSign?: boolean | string;
677
+ /** Automatically stash before merge and unstash after */
678
+ autostash?: boolean;
679
+ /** Silently overwrite ignored files */
680
+ overwriteIgnore?: boolean;
681
+ /** Add Signed-off-by trailer */
682
+ signoff?: boolean;
683
+ /** Use custom branch name in merge commit message */
684
+ intoName?: string;
288
685
  };
289
686
  /**
290
687
  * Merge result
@@ -313,6 +710,72 @@ export type PullOpts = {
313
710
  prune?: boolean;
314
711
  /** Progress callback */
315
712
  onProgress?: (progress: GitProgress) => void;
713
+ /** Be verbose */
714
+ verbose?: boolean;
715
+ /** Be quiet */
716
+ quiet?: boolean;
717
+ /** Fetch submodules recursively */
718
+ recurseSubmodules?: boolean | 'yes' | 'on-demand' | 'no';
719
+ /** Do not show diffstat at end of merge */
720
+ noStat?: boolean;
721
+ /** Show diffstat at end of merge */
722
+ stat?: boolean;
723
+ /** Show compact summary of changed files */
724
+ compactSummary?: boolean;
725
+ /** Add log of commits being merged (optionally with count) */
726
+ log?: boolean | number;
727
+ /** Add Signed-off-by trailer */
728
+ signoff?: boolean;
729
+ /** Squash merge */
730
+ squash?: boolean;
731
+ /** Perform merge and commit (or not) */
732
+ commit?: boolean;
733
+ /** How to clean up the commit message */
734
+ cleanup?: string;
735
+ /** Run hooks or not */
736
+ verify?: boolean;
737
+ /** Verify that commit is signed with a valid key */
738
+ verifySignatures?: boolean;
739
+ /** Automatically stash before pull and unstash after */
740
+ autostash?: boolean;
741
+ /** Merge strategy to use */
742
+ strategy?: string;
743
+ /** Strategy options */
744
+ strategyOption?: string | Array<string>;
745
+ /** GPG-sign the merge commit (optionally with key id) */
746
+ gpgSign?: boolean | string;
747
+ /** Allow merging histories that do not share a common ancestor */
748
+ allowUnrelatedHistories?: boolean;
749
+ /** Fetch from all remotes */
750
+ all?: boolean;
751
+ /** Append ref names and object names to FETCH_HEAD */
752
+ append?: boolean;
753
+ /** Force update of local branches */
754
+ force?: boolean;
755
+ /** Number of parallel children for fetching submodules */
756
+ jobs?: number;
757
+ /** Dry run */
758
+ dryRun?: boolean;
759
+ /** Keep downloaded pack */
760
+ keep?: boolean;
761
+ /** Limit fetching depth */
762
+ depth?: number;
763
+ /** Deepen shallow clone since date */
764
+ shallowSince?: string | Date;
765
+ /** Deepen shallow clone excluding revision */
766
+ shallowExclude?: string | Array<string>;
767
+ /** Deepen shallow clone by specified commits */
768
+ deepen?: number;
769
+ /** Convert shallow repository to complete one */
770
+ unshallow?: boolean;
771
+ /** Update shallow boundary if new refs need it */
772
+ updateShallow?: boolean;
773
+ /** Use IPv4 addresses only */
774
+ ipv4?: boolean;
775
+ /** Use IPv6 addresses only */
776
+ ipv6?: boolean;
777
+ /** Set upstream tracking for the current branch */
778
+ setUpstream?: boolean;
316
779
  };
317
780
  /**
318
781
  * Options for git reset
@@ -320,6 +783,16 @@ export type PullOpts = {
320
783
  export type ResetOpts = {
321
784
  /** Reset mode */
322
785
  mode?: 'soft' | 'mixed' | 'hard' | 'merge' | 'keep';
786
+ /** Be quiet (report only errors) */
787
+ quiet?: boolean;
788
+ /** Skip refreshing the index after reset */
789
+ noRefresh?: boolean;
790
+ /** Reset submodules */
791
+ recurseSubmodules?: boolean;
792
+ /** Record intention to add unstaged files */
793
+ intentToAdd?: boolean;
794
+ /** Read pathspecs from file instead of command line */
795
+ pathspecFromFile?: string;
323
796
  };
324
797
  /**
325
798
  * Options for git rm
@@ -333,6 +806,14 @@ export type RmOpts = {
333
806
  recursive?: boolean;
334
807
  /** Dry run */
335
808
  dryRun?: boolean;
809
+ /** Suppress output */
810
+ quiet?: boolean;
811
+ /** Exit with zero status even if no files matched */
812
+ ignoreUnmatch?: boolean;
813
+ /** Allow removing files outside of sparse-checkout cone */
814
+ sparse?: boolean;
815
+ /** Read pathspecs from file instead of command line */
816
+ pathspecFromFile?: string;
336
817
  };
337
818
  /**
338
819
  * Stash entry
@@ -355,6 +836,14 @@ export type StashPushOpts = {
355
836
  keepIndex?: boolean;
356
837
  /** Specific paths to stash */
357
838
  paths?: Array<string>;
839
+ /** Stash only staged changes */
840
+ staged?: boolean;
841
+ /** Suppress output */
842
+ quiet?: boolean;
843
+ /** Stash all files including untracked and ignored */
844
+ all?: boolean;
845
+ /** Read pathspecs from file instead of command line */
846
+ pathspecFromFile?: string;
358
847
  };
359
848
  /**
360
849
  * Options for git stash pop/apply
@@ -381,6 +870,24 @@ export type SwitchOpts = {
381
870
  track?: boolean;
382
871
  /** Detach HEAD */
383
872
  detach?: boolean;
873
+ /** Try to guess remote tracking branch if target not found */
874
+ guess?: boolean;
875
+ /** Suppress progress reporting */
876
+ quiet?: boolean;
877
+ /** Update submodules */
878
+ recurseSubmodules?: boolean;
879
+ /** Merge local modifications with the new branch */
880
+ merge?: boolean;
881
+ /** Conflict style for merge conflicts */
882
+ conflict?: 'merge' | 'diff3' | 'zdiff3';
883
+ /** Force switch (throw away local modifications) */
884
+ force?: boolean;
885
+ /** Create new orphan branch */
886
+ orphan?: boolean;
887
+ /** Silently overwrite ignored files */
888
+ overwriteIgnore?: boolean;
889
+ /** Ignore if branch is checked out in other worktrees */
890
+ ignoreOtherWorktrees?: boolean;
384
891
  };
385
892
  /**
386
893
  * Tag information
@@ -404,6 +911,20 @@ export type TagListOpts = {
404
911
  pattern?: string;
405
912
  /** Sort by */
406
913
  sort?: string;
914
+ /** Print n lines of tag message */
915
+ lines?: number;
916
+ /** Only list tags that contain the specified commit */
917
+ contains?: string;
918
+ /** Only list tags that don't contain the specified commit */
919
+ noContains?: string;
920
+ /** Only list tags whose tips are reachable from the specified commit */
921
+ merged?: string;
922
+ /** Only list tags whose tips are not reachable from the specified commit */
923
+ noMerged?: string;
924
+ /** Only list tags that point at the specified object */
925
+ pointsAt?: string;
926
+ /** Sorting and filtering are case insensitive */
927
+ ignoreCase?: boolean;
407
928
  };
408
929
  /**
409
930
  * Options for creating a tag
@@ -417,6 +938,16 @@ export type TagCreateOpts = {
417
938
  commit?: string;
418
939
  /** GPG-sign the tag with the default key */
419
940
  sign?: boolean;
941
+ /** Read tag message from file */
942
+ file?: string;
943
+ /** Add trailers to the tag message */
944
+ trailer?: string | Array<string>;
945
+ /** How to clean up the tag message */
946
+ cleanup?: string;
947
+ /** Key to use for GPG signing */
948
+ localUser?: string;
949
+ /** Create the tag's reflog */
950
+ createReflog?: boolean;
420
951
  };
421
952
  /**
422
953
  * Options for git cherry-pick
@@ -440,6 +971,24 @@ export type CherryPickOpts = {
440
971
  skip?: boolean;
441
972
  /** Bypass pre-commit hook */
442
973
  noVerify?: boolean;
974
+ /** How to clean up the commit message */
975
+ cleanup?: 'strip' | 'whitespace' | 'verbatim' | 'scissors' | 'default';
976
+ /** Automatically update rerere state */
977
+ rerereAutoupdate?: boolean;
978
+ /** Strategy options */
979
+ strategyOption?: string | Array<string>;
980
+ /** GPG-sign the commit (optionally with key id) */
981
+ gpgSign?: boolean | string;
982
+ /** Append (cherry picked from ...) line to original message */
983
+ appendCommitName?: boolean;
984
+ /** Fast-forward if possible */
985
+ ff?: boolean;
986
+ /** Allow recording empty commits */
987
+ allowEmpty?: boolean;
988
+ /** Allow empty commit messages */
989
+ allowEmptyMessage?: boolean;
990
+ /** How to handle originally empty commits */
991
+ empty?: 'drop' | 'keep' | 'stop';
443
992
  };
444
993
  /**
445
994
  * Options for git clean
@@ -457,6 +1006,10 @@ export type CleanOpts = {
457
1006
  dryRun?: boolean;
458
1007
  /** Paths to clean */
459
1008
  paths?: Array<string>;
1009
+ /** Suppress output */
1010
+ quiet?: boolean;
1011
+ /** Exclude files matching pattern */
1012
+ exclude?: string | Array<string>;
460
1013
  };
461
1014
  /**
462
1015
  * Options for git mv
@@ -466,6 +1019,12 @@ export type MvOpts = {
466
1019
  force?: boolean;
467
1020
  /** Dry run */
468
1021
  dryRun?: boolean;
1022
+ /** Be verbose */
1023
+ verbose?: boolean;
1024
+ /** Skip errors */
1025
+ skipErrors?: boolean;
1026
+ /** Allow moving files outside of sparse-checkout cone */
1027
+ sparse?: boolean;
469
1028
  };
470
1029
  /**
471
1030
  * Options for git rebase
@@ -487,6 +1046,54 @@ export type RebaseOpts = {
487
1046
  skip?: boolean;
488
1047
  /** Bypass pre-rebase hook */
489
1048
  noVerify?: boolean;
1049
+ /** Keep the commits at the base unchanged */
1050
+ keepBase?: boolean;
1051
+ /** Be quiet */
1052
+ quiet?: boolean;
1053
+ /** Be verbose */
1054
+ verbose?: boolean;
1055
+ /** Add signoff */
1056
+ signoff?: boolean;
1057
+ /** Set committer date to author date */
1058
+ committerDateIsAuthorDate?: boolean;
1059
+ /** Set author date to committer date */
1060
+ resetAuthorDate?: boolean;
1061
+ /** Ignore whitespace differences */
1062
+ ignoreWhitespace?: boolean;
1063
+ /** Whitespace handling mode */
1064
+ whitespace?: string;
1065
+ /** Force rebase even if already up-to-date */
1066
+ forceRebase?: boolean;
1067
+ /** Create merge commit instead of rebasing */
1068
+ noFf?: boolean;
1069
+ /** Use apply strategy */
1070
+ apply?: boolean;
1071
+ /** Automatically update rerere state */
1072
+ rerereAutoupdate?: boolean;
1073
+ /** How to handle empty commits */
1074
+ empty?: 'drop' | 'keep' | 'ask';
1075
+ /** Automatically squash fixup commits */
1076
+ autosquash?: boolean;
1077
+ /** Update refs that point to rebased commits */
1078
+ updateRefs?: boolean;
1079
+ /** GPG-sign commits */
1080
+ gpgSign?: boolean | string;
1081
+ /** Automatically stash/unstash */
1082
+ autostash?: boolean;
1083
+ /** Execute command after each commit */
1084
+ exec?: string;
1085
+ /** Use fork point for base */
1086
+ forkPoint?: boolean;
1087
+ /** Merge strategy */
1088
+ strategy?: string;
1089
+ /** Strategy options */
1090
+ strategyOption?: string | Array<string>;
1091
+ /** Rebase from root commit */
1092
+ root?: boolean;
1093
+ /** Reschedule failed exec commands */
1094
+ rescheduleFailedExec?: boolean;
1095
+ /** Reapply cherry-picks */
1096
+ reapplyCherryPicks?: boolean;
490
1097
  };
491
1098
  /**
492
1099
  * Options for git restore
@@ -501,6 +1108,24 @@ export type RestoreOpts = {
501
1108
  /** Ours or theirs for conflicts */
502
1109
  ours?: boolean;
503
1110
  theirs?: boolean;
1111
+ /** Ignore unmerged entries */
1112
+ ignoreUnmerged?: boolean;
1113
+ /** Allow overlay mode (default is no-overlay) */
1114
+ overlay?: boolean;
1115
+ /** Suppress output */
1116
+ quiet?: boolean;
1117
+ /** Recurse into submodules */
1118
+ recurseSubmodules?: boolean;
1119
+ /** Show progress */
1120
+ progress?: boolean;
1121
+ /** Attempt to recreate merge conflicts */
1122
+ merge?: boolean;
1123
+ /** Conflict style for merge conflicts */
1124
+ conflict?: 'merge' | 'diff3' | 'zdiff3';
1125
+ /** Ignore skip-worktree bits */
1126
+ ignoreSkipWorktreeBits?: boolean;
1127
+ /** Read pathspecs from file */
1128
+ pathspecFromFile?: string;
504
1129
  };
505
1130
  /**
506
1131
  * Options for git revert
@@ -520,6 +1145,20 @@ export type RevertOpts = {
520
1145
  skip?: boolean;
521
1146
  /** Bypass pre-commit hook */
522
1147
  noVerify?: boolean;
1148
+ /** How to clean up the commit message */
1149
+ cleanup?: 'strip' | 'whitespace' | 'verbatim' | 'scissors' | 'default';
1150
+ /** Add signoff */
1151
+ signoff?: boolean;
1152
+ /** Automatically update rerere state */
1153
+ rerereAutoupdate?: boolean;
1154
+ /** Merge strategy */
1155
+ strategy?: string;
1156
+ /** Strategy options */
1157
+ strategyOption?: string | Array<string>;
1158
+ /** GPG-sign the commit */
1159
+ gpgSign?: boolean | string;
1160
+ /** Add reference to reverted commit */
1161
+ reference?: boolean;
523
1162
  };
524
1163
  /**
525
1164
  * Options for git show
@@ -533,6 +1172,18 @@ export type ShowOpts = {
533
1172
  nameStatus?: boolean;
534
1173
  /** Format string */
535
1174
  format?: string;
1175
+ /** Suppress output */
1176
+ quiet?: boolean;
1177
+ /** Show source ref for each commit */
1178
+ source?: boolean;
1179
+ /** Use mailmap for author/committer names */
1180
+ useMailmap?: boolean;
1181
+ /** Only decorate refs matching pattern */
1182
+ decorateRefs?: string;
1183
+ /** Exclude refs matching pattern from decoration */
1184
+ decorateRefsExclude?: string;
1185
+ /** Decorate style */
1186
+ decorate?: 'short' | 'full' | 'auto' | 'no';
536
1187
  };
537
1188
  /**
538
1189
  * Options for git submodule
@@ -546,6 +1197,83 @@ export type SubmoduleOpts = {
546
1197
  remote?: boolean;
547
1198
  /** Force update */
548
1199
  force?: boolean;
1200
+ /** Do not fetch from remotes */
1201
+ noFetch?: boolean;
1202
+ /** Checkout the superproject's recorded commit */
1203
+ checkout?: boolean;
1204
+ /** Merge the commit into the current branch */
1205
+ merge?: boolean;
1206
+ /** Rebase the current branch onto the commit */
1207
+ rebase?: boolean;
1208
+ /** Use recommended shallow clone depth */
1209
+ recommendShallow?: boolean;
1210
+ /** Reference repository for shared clone */
1211
+ reference?: string;
1212
+ /** Clone only one branch */
1213
+ singleBranch?: boolean;
1214
+ /** Partial clone filter specification */
1215
+ filter?: string;
1216
+ };
1217
+ /**
1218
+ * Options for adding a submodule
1219
+ */
1220
+ export type SubmoduleAddOpts = {
1221
+ /** Branch to track */
1222
+ branch?: string;
1223
+ /** Force addition */
1224
+ force?: boolean;
1225
+ /** Submodule name (if different from path) */
1226
+ name?: string;
1227
+ /** Reference repository */
1228
+ reference?: string;
1229
+ /** Depth for shallow clone */
1230
+ depth?: number;
1231
+ };
1232
+ /**
1233
+ * Options for deinitializing a submodule
1234
+ */
1235
+ export type SubmoduleDeinitOpts = {
1236
+ /** Force deinitialization */
1237
+ force?: boolean;
1238
+ /** Deinitialize all submodules */
1239
+ all?: boolean;
1240
+ };
1241
+ /**
1242
+ * Options for submodule status
1243
+ */
1244
+ export type SubmoduleStatusOpts = {
1245
+ /** Check submodules recursively */
1246
+ recursive?: boolean;
1247
+ };
1248
+ /**
1249
+ * Options for submodule summary
1250
+ */
1251
+ export type SubmoduleSummaryOpts = {
1252
+ /** Limit to the specified number of commits */
1253
+ limit?: number;
1254
+ /** Show files in the summary */
1255
+ files?: boolean;
1256
+ };
1257
+ /**
1258
+ * Options for submodule foreach
1259
+ */
1260
+ export type SubmoduleForeachOpts = {
1261
+ /** Run the command recursively in nested submodules */
1262
+ recursive?: boolean;
1263
+ };
1264
+ /**
1265
+ * Options for submodule sync
1266
+ */
1267
+ export type SubmoduleSyncOpts = {
1268
+ /** Sync recursively in nested submodules */
1269
+ recursive?: boolean;
1270
+ };
1271
+ /**
1272
+ * Options for submodule set-branch
1273
+ */
1274
+ export type SubmoduleSetBranchOpts = {
1275
+ /** Set the default tracking branch */
1276
+ default?: boolean;
549
1277
  };
550
1278
  /**
551
1279
  * Submodule information
@@ -582,12 +1310,18 @@ export type LfsPullOpts = {
582
1310
  export type LfsPushOpts = {
583
1311
  remote?: string;
584
1312
  ref?: string;
1313
+ /** Dry run - show what would be pushed without actually pushing */
1314
+ dryRun?: boolean;
1315
+ /** Push specified object IDs */
1316
+ objectId?: boolean;
585
1317
  };
586
1318
  /**
587
1319
  * Options for LFS status
588
1320
  */
589
1321
  export type LfsStatusOpts = {
590
1322
  json?: boolean;
1323
+ /** Machine-readable output */
1324
+ porcelain?: boolean;
591
1325
  };
592
1326
  /**
593
1327
  * Options for LFS prune
@@ -601,6 +1335,333 @@ export type LfsPruneOpts = {
601
1335
  verifyRemote?: boolean;
602
1336
  /** Verify unreferenced copies */
603
1337
  verifyUnreferenced?: boolean;
1338
+ /** Only prune objects not accessed recently */
1339
+ recent?: boolean;
1340
+ /** Show verbose output */
1341
+ verbose?: boolean;
1342
+ /** When unverified behavior: panic or ignore */
1343
+ whenUnverified?: 'panic' | 'ignore';
1344
+ };
1345
+ /**
1346
+ * Options for LFS fetch
1347
+ */
1348
+ export type LfsFetchOpts = {
1349
+ /** Fetch all LFS objects for all refs */
1350
+ all?: boolean;
1351
+ /** Include patterns */
1352
+ include?: string | Array<string>;
1353
+ /** Exclude patterns */
1354
+ exclude?: string | Array<string>;
1355
+ /** Only fetch recent objects */
1356
+ recent?: boolean;
1357
+ /** Prune old objects after fetch */
1358
+ prune?: boolean;
1359
+ /** Refetch objects even if already local */
1360
+ refetch?: boolean;
1361
+ /** Dry run - show what would be fetched */
1362
+ dryRun?: boolean;
1363
+ /** Output in JSON format */
1364
+ json?: boolean;
1365
+ /** Remote to fetch from */
1366
+ remote?: string;
1367
+ /** Refs to fetch */
1368
+ refs?: string | Array<string>;
1369
+ };
1370
+ /**
1371
+ * Options for repository-level LFS install
1372
+ *
1373
+ * Used with `repo.lfs.install()` for repository-local LFS configuration.
1374
+ *
1375
+ * @remarks
1376
+ * Internally runs `git lfs install --local` by default, which writes to
1377
+ * the repository's .git/config file. This ensures LFS configuration is
1378
+ * scoped to the current repository only.
1379
+ *
1380
+ * For global (user-level) or system-wide installation, use `git.lfs.install()` instead.
1381
+ */
1382
+ export type RepoLfsInstallOpts = {
1383
+ /** Overwrite existing hooks */
1384
+ force?: boolean;
1385
+ /**
1386
+ * Install for worktree only (instead of repository)
1387
+ *
1388
+ * @remarks
1389
+ * Internally uses `--worktree` flag instead of `--local`.
1390
+ * Requires Git 2.20.0+ with worktreeConfig extension enabled.
1391
+ */
1392
+ worktree?: boolean;
1393
+ /** Skip smudge filter (don't download during checkout) */
1394
+ skipSmudge?: boolean;
1395
+ };
1396
+ /**
1397
+ * Options for repository-level LFS uninstall
1398
+ *
1399
+ * Used with `repo.lfs.uninstall()` for repository-local LFS configuration removal.
1400
+ *
1401
+ * @remarks
1402
+ * Internally runs `git lfs uninstall --local` by default, which modifies
1403
+ * the repository's .git/config file only.
1404
+ *
1405
+ * For global or system-wide uninstallation, use `git.lfs.uninstall()` instead.
1406
+ */
1407
+ export type RepoLfsUninstallOpts = {
1408
+ /**
1409
+ * Uninstall for worktree only (instead of repository)
1410
+ *
1411
+ * @remarks
1412
+ * Internally uses `--worktree` flag instead of `--local`.
1413
+ * Requires Git 2.20.0+ with worktreeConfig extension enabled.
1414
+ */
1415
+ worktree?: boolean;
1416
+ };
1417
+ /**
1418
+ * LFS file entry
1419
+ */
1420
+ export type LfsFileEntry = {
1421
+ /** File path */
1422
+ path: string;
1423
+ /** Object ID (SHA-256) */
1424
+ oid: string;
1425
+ /** File size in bytes */
1426
+ size?: number;
1427
+ /** Checkout status */
1428
+ status: 'checked-out' | 'not-checked-out';
1429
+ };
1430
+ /**
1431
+ * Options for LFS ls-files
1432
+ */
1433
+ export type LfsLsFilesOpts = {
1434
+ /** Show full OID (not abbreviated) */
1435
+ long?: boolean;
1436
+ /** Show file sizes */
1437
+ size?: boolean;
1438
+ /** Show debug information */
1439
+ debug?: boolean;
1440
+ /** Show all LFS files (not just current ref) */
1441
+ all?: boolean;
1442
+ /** Show deleted files */
1443
+ deleted?: boolean;
1444
+ /** Include patterns */
1445
+ include?: string | Array<string>;
1446
+ /** Exclude patterns */
1447
+ exclude?: string | Array<string>;
1448
+ /** Show filenames only */
1449
+ nameOnly?: boolean;
1450
+ /** Output in JSON format */
1451
+ json?: boolean;
1452
+ /** Ref to list files for */
1453
+ ref?: string;
1454
+ };
1455
+ /**
1456
+ * LFS track entry
1457
+ */
1458
+ export type LfsTrackEntry = {
1459
+ /** Pattern being tracked */
1460
+ pattern: string;
1461
+ /** Source file (e.g., .gitattributes) */
1462
+ source: string;
1463
+ /** Whether files matching pattern are lockable */
1464
+ lockable: boolean;
1465
+ };
1466
+ /**
1467
+ * Options for LFS track
1468
+ */
1469
+ export type LfsTrackOpts = {
1470
+ /** Show verbose output */
1471
+ verbose?: boolean;
1472
+ /** Dry run - show what would be tracked */
1473
+ dryRun?: boolean;
1474
+ /** Treat pattern as filename, not glob */
1475
+ filename?: boolean;
1476
+ /** Make files lockable */
1477
+ lockable?: boolean;
1478
+ /** Make files not lockable */
1479
+ notLockable?: boolean;
1480
+ /** Don't exclude from export */
1481
+ noExcluded?: boolean;
1482
+ /** Don't modify .gitattributes */
1483
+ noModifyAttrs?: boolean;
1484
+ };
1485
+ /**
1486
+ * LFS lock entry
1487
+ */
1488
+ export type LfsLockEntry = {
1489
+ /** Lock ID */
1490
+ id: string;
1491
+ /** Locked file path */
1492
+ path: string;
1493
+ /** Lock owner */
1494
+ owner: {
1495
+ name: string;
1496
+ };
1497
+ /** Lock timestamp */
1498
+ lockedAt: Date;
1499
+ };
1500
+ /**
1501
+ * Options for LFS lock
1502
+ */
1503
+ export type LfsLockOpts = {
1504
+ /** Remote name */
1505
+ remote?: string;
1506
+ /** Output in JSON format */
1507
+ json?: boolean;
1508
+ };
1509
+ /**
1510
+ * Options for LFS unlock
1511
+ */
1512
+ export type LfsUnlockOpts = {
1513
+ /** Remote name */
1514
+ remote?: string;
1515
+ /** Force unlock (even if owned by another user) */
1516
+ force?: boolean;
1517
+ /** Unlock by ID instead of path */
1518
+ id?: string;
1519
+ /** Output in JSON format */
1520
+ json?: boolean;
1521
+ };
1522
+ /**
1523
+ * Options for LFS locks
1524
+ */
1525
+ export type LfsLocksOpts = {
1526
+ /** Remote name */
1527
+ remote?: string;
1528
+ /** Filter by lock ID */
1529
+ id?: string;
1530
+ /** Filter by path */
1531
+ path?: string;
1532
+ /** Show local cache only */
1533
+ local?: boolean;
1534
+ /** Show cached locks */
1535
+ cached?: boolean;
1536
+ /** Verify locks with server */
1537
+ verify?: boolean;
1538
+ /** Limit number of results */
1539
+ limit?: number;
1540
+ /** Output in JSON format */
1541
+ json?: boolean;
1542
+ };
1543
+ /**
1544
+ * Options for LFS checkout
1545
+ */
1546
+ export type LfsCheckoutOpts = {
1547
+ /** Use base version for conflicts */
1548
+ base?: boolean;
1549
+ /** Use ours version for conflicts */
1550
+ ours?: boolean;
1551
+ /** Use theirs version for conflicts */
1552
+ theirs?: boolean;
1553
+ /** Write to file instead of working tree */
1554
+ to?: string;
1555
+ /** Include patterns */
1556
+ include?: string | Array<string>;
1557
+ /** Exclude patterns */
1558
+ exclude?: string | Array<string>;
1559
+ };
1560
+ /**
1561
+ * Options for LFS migrate info
1562
+ */
1563
+ export type LfsMigrateInfoOpts = {
1564
+ /** Only show files above this size */
1565
+ above?: string | number;
1566
+ /** Show top N files */
1567
+ top?: number;
1568
+ /** Size unit (b, kb, mb, gb) */
1569
+ unit?: 'b' | 'kb' | 'mb' | 'gb';
1570
+ /** Show pointer files */
1571
+ pointers?: 'follow' | 'no-follow' | 'ignore';
1572
+ /** Fix up tracking patterns */
1573
+ fixup?: boolean;
1574
+ /** Include patterns */
1575
+ include?: string | Array<string>;
1576
+ /** Exclude patterns */
1577
+ exclude?: string | Array<string>;
1578
+ /** Include refs */
1579
+ includeRef?: string | Array<string>;
1580
+ /** Exclude refs */
1581
+ excludeRef?: string | Array<string>;
1582
+ /** Skip fetching from remote */
1583
+ skipFetch?: boolean;
1584
+ /** Operate on all refs */
1585
+ everything?: boolean;
1586
+ /** Confirm destructive operation */
1587
+ yesReally?: boolean;
1588
+ };
1589
+ /**
1590
+ * Options for LFS migrate import
1591
+ */
1592
+ export type LfsMigrateImportOpts = LfsMigrateInfoOpts & {
1593
+ /** Show verbose output */
1594
+ verbose?: boolean;
1595
+ /** Write object map file */
1596
+ objectMap?: string;
1597
+ /** Don't rewrite history */
1598
+ noRewrite?: boolean;
1599
+ /** Commit message for fixup */
1600
+ message?: string;
1601
+ /** Object IDs to import */
1602
+ object?: string | Array<string>;
1603
+ };
1604
+ /**
1605
+ * Options for LFS migrate export
1606
+ */
1607
+ export type LfsMigrateExportOpts = LfsMigrateInfoOpts & {
1608
+ /** Show verbose output */
1609
+ verbose?: boolean;
1610
+ /** Write object map file */
1611
+ objectMap?: string;
1612
+ /** Remote name */
1613
+ remote?: string;
1614
+ };
1615
+ /**
1616
+ * LFS environment info
1617
+ */
1618
+ export type LfsEnvInfo = {
1619
+ /** LFS version */
1620
+ lfsVersion: string;
1621
+ /** Git version */
1622
+ gitVersion: string;
1623
+ /** Endpoint URL */
1624
+ endpoint: string;
1625
+ /** SSH endpoint */
1626
+ sshEndpoint?: string;
1627
+ /** Local working directory */
1628
+ localWorkingDir?: string;
1629
+ /** Local git directory */
1630
+ localGitDir?: string;
1631
+ /** Local git storage directory */
1632
+ localGitStorageDir?: string;
1633
+ /** Local media directory */
1634
+ localMediaDir?: string;
1635
+ /** Local reference directories */
1636
+ localReferenceDirs?: string;
1637
+ /** Temp directory */
1638
+ tempDir?: string;
1639
+ /** Concurrent transfers */
1640
+ concurrentTransfers?: number;
1641
+ /** TUS transfers enabled */
1642
+ tusTransfers?: boolean;
1643
+ /** Basic transfers only */
1644
+ basicTransfersOnly?: boolean;
1645
+ /** Skip download errors */
1646
+ skipDownloadErrors?: boolean;
1647
+ /** Fetch recent always */
1648
+ fetchRecentAlways?: boolean;
1649
+ /** Fetch recent refs days */
1650
+ fetchRecentRefsDays?: number;
1651
+ /** Fetch recent commits days */
1652
+ fetchRecentCommitsDays?: number;
1653
+ /** Fetch recent refs include remotes */
1654
+ fetchRecentRefsIncludeRemotes?: boolean;
1655
+ /** Prune offset days */
1656
+ pruneOffsetDays?: number;
1657
+ /** Prune verify remote always */
1658
+ pruneVerifyRemoteAlways?: boolean;
1659
+ /** Prune remote name */
1660
+ pruneRemoteName?: string;
1661
+ /** Access mode for downloads */
1662
+ accessDownload?: string;
1663
+ /** Access mode for uploads */
1664
+ accessUpload?: string;
604
1665
  };
605
1666
  /**
606
1667
  * Options for LFS pre-upload (§10.3)
@@ -675,12 +1736,36 @@ export type Worktree = {
675
1736
  * Options for adding a worktree
676
1737
  */
677
1738
  export type WorktreeAddOpts = {
678
- /** Branch name to create or checkout */
1739
+ /**
1740
+ * Commit-ish to checkout (branch, tag, or commit hash)
1741
+ *
1742
+ * @example
1743
+ * ```typescript
1744
+ * // Checkout a specific commit in detached mode
1745
+ * await repo.worktree.add('/tmp/worktree', { detach: true, commitish: 'abc1234' });
1746
+ *
1747
+ * // Checkout a tag
1748
+ * await repo.worktree.add('/tmp/worktree', { detach: true, commitish: 'v1.0.0' });
1749
+ *
1750
+ * // Checkout a branch
1751
+ * await repo.worktree.add('/tmp/worktree', { commitish: 'feature-branch' });
1752
+ * ```
1753
+ */
1754
+ commitish?: string;
1755
+ /** Branch name to create (-b flag) */
679
1756
  branch?: string;
680
1757
  /** Create detached HEAD */
681
1758
  detach?: boolean;
682
1759
  /** Track remote branch */
683
1760
  track?: boolean;
1761
+ /** Force creation even if branch is already checked out */
1762
+ force?: boolean;
1763
+ /** Checkout the worktree (true) or not (false) */
1764
+ checkout?: boolean;
1765
+ /** Keep the worktree locked after creation */
1766
+ lock?: boolean;
1767
+ /** Create worktree with orphan branch */
1768
+ orphan?: boolean;
684
1769
  };
685
1770
  /**
686
1771
  * Options for removing a worktree
@@ -697,7 +1782,20 @@ export type WorktreePruneOpts = {
697
1782
  dryRun?: boolean;
698
1783
  /** Show more details */
699
1784
  verbose?: boolean;
1785
+ /** Expire worktrees older than the given time */
1786
+ expire?: string;
1787
+ };
1788
+ /**
1789
+ * Options for worktree move
1790
+ */
1791
+ export type WorktreeMoveOpts = {
1792
+ /** Force move even if destination exists */
1793
+ force?: boolean;
700
1794
  };
1795
+ /**
1796
+ * Options for worktree repair
1797
+ */
1798
+ export type WorktreeRepairOpts = {};
701
1799
  /**
702
1800
  * Options for locking a worktree
703
1801
  */
@@ -706,67 +1804,231 @@ export type WorktreeLockOpts = {
706
1804
  reason?: string;
707
1805
  };
708
1806
  /**
709
- * Worktree operations interface (§7.4)
1807
+ * Worktree operations
1808
+ *
1809
+ * Wraps: `git worktree` subcommands
710
1810
  */
711
1811
  export interface WorktreeOperations {
712
1812
  /**
713
- * List all worktrees (parses --porcelain output)
1813
+ * List all worktrees
1814
+ *
1815
+ * Wraps: `git worktree list --porcelain`
714
1816
  */
715
1817
  list(opts?: ExecOpts): Promise<Array<Worktree>>;
716
1818
  /**
717
- * Add a new worktree
1819
+ * Add a new worktree and return a repository object for it
1820
+ *
1821
+ * Wraps: `git worktree add <path>`
1822
+ *
1823
+ * @returns A WorktreeRepo instance for the newly created worktree
718
1824
  */
719
- add(path: string, opts?: WorktreeAddOpts & ExecOpts): Promise<void>;
1825
+ add(path: string, opts?: WorktreeAddOpts & ExecOpts): Promise<WorktreeRepo>;
720
1826
  /**
721
1827
  * Remove a worktree
1828
+ *
1829
+ * Wraps: `git worktree remove <path>`
722
1830
  */
723
1831
  remove(path: string, opts?: WorktreeRemoveOpts & ExecOpts): Promise<void>;
724
1832
  /**
725
1833
  * Prune stale worktree references
1834
+ *
1835
+ * Wraps: `git worktree prune`
726
1836
  */
727
1837
  prune(opts?: WorktreePruneOpts & ExecOpts): Promise<Array<string>>;
728
1838
  /**
729
1839
  * Lock a worktree
1840
+ *
1841
+ * Wraps: `git worktree lock <path>`
730
1842
  */
731
1843
  lock(path: string, opts?: WorktreeLockOpts & ExecOpts): Promise<void>;
732
1844
  /**
733
1845
  * Unlock a worktree
1846
+ *
1847
+ * Wraps: `git worktree unlock <path>`
734
1848
  */
735
1849
  unlock(path: string, opts?: ExecOpts): Promise<void>;
1850
+ /**
1851
+ * Move a worktree to a new location and return a repository object for it
1852
+ *
1853
+ * Wraps: `git worktree move <src> <dst>`
1854
+ *
1855
+ * @returns A WorktreeRepo instance for the worktree at the new location
1856
+ */
1857
+ move(src: string, dst: string, opts?: WorktreeMoveOpts & ExecOpts): Promise<WorktreeRepo>;
1858
+ /**
1859
+ * Repair worktree administrative files
1860
+ *
1861
+ * Wraps: `git worktree repair`
1862
+ */
1863
+ repair(paths?: Array<string>, opts?: ExecOpts): Promise<void>;
736
1864
  }
737
1865
  /**
738
- * LFS operations interface
1866
+ * LFS operations
1867
+ *
1868
+ * Wraps: `git lfs` subcommands
739
1869
  */
740
1870
  export interface LfsOperations {
741
1871
  /**
742
1872
  * Pull LFS objects
1873
+ *
1874
+ * Wraps: `git lfs pull`
743
1875
  */
744
1876
  pull(opts?: LfsPullOpts & ExecOpts): Promise<void>;
745
1877
  /**
746
1878
  * Push LFS objects
1879
+ *
1880
+ * Wraps: `git lfs push`
747
1881
  */
748
1882
  push(opts?: LfsPushOpts & ExecOpts): Promise<void>;
749
1883
  /**
750
1884
  * Get LFS status
1885
+ *
1886
+ * Wraps: `git lfs status`
751
1887
  */
752
1888
  status(opts?: LfsStatusOpts & ExecOpts): Promise<LfsStatus>;
753
1889
  /**
754
1890
  * Prune old and unreferenced LFS objects from local storage
1891
+ *
1892
+ * Wraps: `git lfs prune`
755
1893
  */
756
1894
  prune(opts?: LfsPruneOpts & ExecOpts): Promise<void>;
757
- }
758
- /**
759
- * LFS Extra operations interface (inspired by fs-extra)
760
- *
761
- * Additional LFS utilities not part of the core LFS commands.
762
- * These enable advanced patterns like 2-phase commit/fetch.
763
- */
764
- export interface LfsExtraOperations {
765
1895
  /**
766
- * Pre-upload LFS objects before refs push (§10.3)
767
- *
768
- * Enables 2-phase commit pattern for improved reliability with large files.
769
- * Objects are uploaded in batches to handle Windows command line limits.
1896
+ * Fetch LFS objects from remote
1897
+ *
1898
+ * Wraps: `git lfs fetch`
1899
+ */
1900
+ fetch(opts?: LfsFetchOpts & ExecOpts): Promise<void>;
1901
+ /**
1902
+ * Install Git LFS hooks for this repository
1903
+ *
1904
+ * Wraps: `git lfs install --local`
1905
+ *
1906
+ * Installs LFS hooks to the repository's .git/config file.
1907
+ * This ensures LFS configuration is scoped to this repository only.
1908
+ *
1909
+ * @remarks
1910
+ * Internally always adds `--local` flag (or `--worktree` if specified).
1911
+ * For global or system-wide installation, use `git.lfs.install()` instead.
1912
+ *
1913
+ * @example
1914
+ * ```typescript
1915
+ * // Install LFS locally for this repository
1916
+ * await repo.lfs.install();
1917
+ *
1918
+ * // Install for worktree only (Git 2.20.0+)
1919
+ * await repo.lfs.install({ worktree: true });
1920
+ * ```
1921
+ */
1922
+ install(opts?: RepoLfsInstallOpts & ExecOpts): Promise<void>;
1923
+ /**
1924
+ * Uninstall Git LFS hooks from this repository
1925
+ *
1926
+ * Wraps: `git lfs uninstall --local`
1927
+ *
1928
+ * Removes LFS hooks from the repository's .git/config file.
1929
+ *
1930
+ * @remarks
1931
+ * Internally always adds `--local` flag (or `--worktree` if specified).
1932
+ * For global or system-wide uninstallation, use `git.lfs.uninstall()` instead.
1933
+ *
1934
+ * @example
1935
+ * ```typescript
1936
+ * // Uninstall LFS from this repository
1937
+ * await repo.lfs.uninstall();
1938
+ * ```
1939
+ */
1940
+ uninstall(opts?: RepoLfsUninstallOpts & ExecOpts): Promise<void>;
1941
+ /**
1942
+ * List LFS files in the repository
1943
+ *
1944
+ * Wraps: `git lfs ls-files`
1945
+ */
1946
+ lsFiles(opts?: LfsLsFilesOpts & ExecOpts): Promise<Array<LfsFileEntry>>;
1947
+ /**
1948
+ * Track files with LFS
1949
+ *
1950
+ * Wraps: `git lfs track <pattern>...`
1951
+ */
1952
+ track(patterns: string | Array<string>, opts?: LfsTrackOpts & ExecOpts): Promise<void>;
1953
+ /**
1954
+ * List tracked patterns
1955
+ *
1956
+ * Wraps: `git lfs track` (without arguments)
1957
+ */
1958
+ trackList(opts?: ExecOpts): Promise<Array<LfsTrackEntry>>;
1959
+ /**
1960
+ * Untrack files from LFS
1961
+ *
1962
+ * Wraps: `git lfs untrack <pattern>...`
1963
+ */
1964
+ untrack(patterns: string | Array<string>, opts?: ExecOpts): Promise<void>;
1965
+ /**
1966
+ * Lock a file
1967
+ *
1968
+ * Wraps: `git lfs lock <path>`
1969
+ */
1970
+ lock(path: string, opts?: LfsLockOpts & ExecOpts): Promise<LfsLockEntry>;
1971
+ /**
1972
+ * Unlock a file
1973
+ *
1974
+ * Wraps: `git lfs unlock <path>`
1975
+ */
1976
+ unlock(pathOrId: string, opts?: LfsUnlockOpts & ExecOpts): Promise<void>;
1977
+ /**
1978
+ * List locked files
1979
+ *
1980
+ * Wraps: `git lfs locks`
1981
+ */
1982
+ locks(opts?: LfsLocksOpts & ExecOpts): Promise<Array<LfsLockEntry>>;
1983
+ /**
1984
+ * Checkout LFS files (replace pointer files with actual content)
1985
+ *
1986
+ * Wraps: `git lfs checkout`
1987
+ */
1988
+ checkout(patterns?: string | Array<string>, opts?: LfsCheckoutOpts & ExecOpts): Promise<void>;
1989
+ /**
1990
+ * Show information about LFS files that would be migrated
1991
+ *
1992
+ * Wraps: `git lfs migrate info`
1993
+ */
1994
+ migrateInfo(opts?: LfsMigrateInfoOpts & ExecOpts): Promise<string>;
1995
+ /**
1996
+ * Import files into LFS
1997
+ *
1998
+ * Wraps: `git lfs migrate import`
1999
+ */
2000
+ migrateImport(opts?: LfsMigrateImportOpts & ExecOpts): Promise<void>;
2001
+ /**
2002
+ * Export files from LFS
2003
+ *
2004
+ * Wraps: `git lfs migrate export`
2005
+ */
2006
+ migrateExport(opts?: LfsMigrateExportOpts & ExecOpts): Promise<void>;
2007
+ /**
2008
+ * Get LFS environment information
2009
+ *
2010
+ * Wraps: `git lfs env`
2011
+ */
2012
+ env(opts?: ExecOpts): Promise<LfsEnvInfo>;
2013
+ /**
2014
+ * Get Git LFS version
2015
+ *
2016
+ * Wraps: `git lfs version`
2017
+ */
2018
+ version(opts?: ExecOpts): Promise<string>;
2019
+ }
2020
+ /**
2021
+ * LFS Extra operations interface (inspired by fs-extra)
2022
+ *
2023
+ * Additional LFS utilities not part of the core LFS commands.
2024
+ * These enable advanced patterns like 2-phase commit/fetch.
2025
+ */
2026
+ export interface LfsExtraOperations {
2027
+ /**
2028
+ * Pre-upload LFS objects before refs push (§10.3)
2029
+ *
2030
+ * Enables 2-phase commit pattern for improved reliability with large files.
2031
+ * Objects are uploaded in batches to handle Windows command line limits.
770
2032
  *
771
2033
  * @example
772
2034
  * ```typescript
@@ -790,77 +2052,113 @@ export interface LfsExtraOperations {
790
2052
  preDownload(opts?: LfsPreDownloadOpts & ExecOpts): Promise<LfsPreDownloadResult>;
791
2053
  }
792
2054
  /**
793
- * Branch operations interface
2055
+ * Branch operations
2056
+ *
2057
+ * Wraps: `git branch` subcommands
794
2058
  */
795
2059
  export interface BranchOperations {
796
2060
  /**
797
2061
  * List branches
2062
+ *
2063
+ * Wraps: `git branch --list`
798
2064
  */
799
2065
  list(opts?: BranchOpts & ExecOpts): Promise<Array<BranchInfo>>;
800
2066
  /**
801
2067
  * Get current branch name
2068
+ *
2069
+ * Wraps: `git branch --show-current`
802
2070
  */
803
2071
  current(opts?: ExecOpts): Promise<string | null>;
804
2072
  /**
805
2073
  * Create a new branch
2074
+ *
2075
+ * Wraps: `git branch <name>`
806
2076
  */
807
2077
  create(name: string, opts?: BranchCreateOpts & ExecOpts): Promise<void>;
808
2078
  /**
809
2079
  * Delete a branch
2080
+ *
2081
+ * Wraps: `git branch -d|-D <name>`
810
2082
  */
811
2083
  delete(name: string, opts?: BranchDeleteOpts & ExecOpts): Promise<void>;
812
2084
  /**
813
2085
  * Rename a branch
2086
+ *
2087
+ * Wraps: `git branch -m <old> <new>`
814
2088
  */
815
2089
  rename(oldName: string, newName: string, opts?: ExecOpts): Promise<void>;
816
2090
  }
817
2091
  /**
818
- * Stash operations interface
2092
+ * Stash operations
2093
+ *
2094
+ * Wraps: `git stash` subcommands
819
2095
  */
820
2096
  export interface StashOperations {
821
2097
  /**
822
2098
  * List stash entries
2099
+ *
2100
+ * Wraps: `git stash list`
823
2101
  */
824
2102
  list(opts?: ExecOpts): Promise<Array<StashEntry>>;
825
2103
  /**
826
2104
  * Push changes to stash
2105
+ *
2106
+ * Wraps: `git stash push`
827
2107
  */
828
2108
  push(opts?: StashPushOpts & ExecOpts): Promise<void>;
829
2109
  /**
830
2110
  * Pop stash entry
2111
+ *
2112
+ * Wraps: `git stash pop`
831
2113
  */
832
2114
  pop(opts?: StashApplyOpts & ExecOpts): Promise<void>;
833
2115
  /**
834
2116
  * Apply stash entry (without removing from stash)
2117
+ *
2118
+ * Wraps: `git stash apply`
835
2119
  */
836
2120
  apply(opts?: StashApplyOpts & ExecOpts): Promise<void>;
837
2121
  /**
838
2122
  * Drop a stash entry
2123
+ *
2124
+ * Wraps: `git stash drop`
839
2125
  */
840
2126
  drop(index?: number, opts?: ExecOpts): Promise<void>;
841
2127
  /**
842
2128
  * Clear all stash entries
2129
+ *
2130
+ * Wraps: `git stash clear`
843
2131
  */
844
2132
  clear(opts?: ExecOpts): Promise<void>;
845
2133
  }
846
2134
  /**
847
- * Tag operations interface
2135
+ * Tag operations
2136
+ *
2137
+ * Wraps: `git tag` subcommands
848
2138
  */
849
2139
  export interface TagOperations {
850
2140
  /**
851
2141
  * List tags
2142
+ *
2143
+ * Wraps: `git tag --list`
852
2144
  */
853
2145
  list(opts?: TagListOpts & ExecOpts): Promise<Array<string>>;
854
2146
  /**
855
2147
  * Create a tag
2148
+ *
2149
+ * Wraps: `git tag <name>`
856
2150
  */
857
2151
  create(name: string, opts?: TagCreateOpts & ExecOpts): Promise<void>;
858
2152
  /**
859
2153
  * Delete a tag
2154
+ *
2155
+ * Wraps: `git tag -d <name>`
860
2156
  */
861
2157
  delete(name: string, opts?: ExecOpts): Promise<void>;
862
2158
  /**
863
2159
  * Get tag info
2160
+ *
2161
+ * Wraps: `git tag -v <name>` / `git show <tag>`
864
2162
  */
865
2163
  show(name: string, opts?: ExecOpts): Promise<TagInfo>;
866
2164
  }
@@ -885,6 +2183,45 @@ export type RemoteAddOpts = {
885
2183
  fetch?: boolean;
886
2184
  /** Set up as mirror */
887
2185
  mirror?: 'fetch' | 'push';
2186
+ /** Import tags from remote (true) or not (false) */
2187
+ tags?: boolean;
2188
+ };
2189
+ /**
2190
+ * Options for remote set-head
2191
+ */
2192
+ export type RemoteSetHeadOpts = {
2193
+ /** Automatically determine remote HEAD */
2194
+ auto?: boolean;
2195
+ /** Delete the symbolic-ref for remote HEAD */
2196
+ delete?: boolean;
2197
+ };
2198
+ /**
2199
+ * Options for remote show
2200
+ */
2201
+ export type RemoteShowOpts = {
2202
+ /** Do not query remote heads */
2203
+ noQuery?: boolean;
2204
+ };
2205
+ /**
2206
+ * Options for remote prune
2207
+ */
2208
+ export type RemotePruneOpts = {
2209
+ /** Dry run - show what would be pruned */
2210
+ dryRun?: boolean;
2211
+ };
2212
+ /**
2213
+ * Options for remote update
2214
+ */
2215
+ export type RemoteUpdateOpts = {
2216
+ /** Prune remote-tracking branches */
2217
+ prune?: boolean;
2218
+ };
2219
+ /**
2220
+ * Options for remote set-branches
2221
+ */
2222
+ export type RemoteSetBranchesOpts = {
2223
+ /** Add branches instead of replacing */
2224
+ add?: boolean;
888
2225
  };
889
2226
  /**
890
2227
  * Options for getting/setting remote URL
@@ -894,33 +2231,77 @@ export type RemoteUrlOpts = {
894
2231
  push?: boolean;
895
2232
  };
896
2233
  /**
897
- * Remote operations interface
2234
+ * Remote operations
2235
+ *
2236
+ * Wraps: `git remote` subcommands
898
2237
  */
899
2238
  export interface RemoteOperations {
900
2239
  /**
901
2240
  * List remotes
2241
+ *
2242
+ * Wraps: `git remote -v`
902
2243
  */
903
2244
  list(opts?: ExecOpts): Promise<Array<RemoteInfo>>;
904
2245
  /**
905
2246
  * Add a remote
2247
+ *
2248
+ * Wraps: `git remote add <name> <url>`
906
2249
  */
907
2250
  add(name: string, url: string, opts?: RemoteAddOpts & ExecOpts): Promise<void>;
908
2251
  /**
909
2252
  * Remove a remote
2253
+ *
2254
+ * Wraps: `git remote remove <name>`
910
2255
  */
911
2256
  remove(name: string, opts?: ExecOpts): Promise<void>;
912
2257
  /**
913
2258
  * Rename a remote
2259
+ *
2260
+ * Wraps: `git remote rename <old> <new>`
914
2261
  */
915
2262
  rename(oldName: string, newName: string, opts?: ExecOpts): Promise<void>;
916
2263
  /**
917
2264
  * Get remote URL
2265
+ *
2266
+ * Wraps: `git remote get-url <name>`
918
2267
  */
919
2268
  getUrl(name: string, opts?: RemoteUrlOpts & ExecOpts): Promise<string>;
920
2269
  /**
921
2270
  * Set remote URL
2271
+ *
2272
+ * Wraps: `git remote set-url <name> <url>`
922
2273
  */
923
2274
  setUrl(name: string, url: string, opts?: RemoteUrlOpts & ExecOpts): Promise<void>;
2275
+ /**
2276
+ * Set remote HEAD
2277
+ *
2278
+ * Wraps: `git remote set-head <remote> <branch>`
2279
+ */
2280
+ setHead(remote: string, branch?: string, opts?: RemoteSetHeadOpts & ExecOpts): Promise<void>;
2281
+ /**
2282
+ * Show information about a remote
2283
+ *
2284
+ * Wraps: `git remote show <remote>`
2285
+ */
2286
+ show(remote: string, opts?: RemoteShowOpts & ExecOpts): Promise<string>;
2287
+ /**
2288
+ * Prune stale remote-tracking branches
2289
+ *
2290
+ * Wraps: `git remote prune <remote>`
2291
+ */
2292
+ prune(remote: string, opts?: RemotePruneOpts & ExecOpts): Promise<Array<string>>;
2293
+ /**
2294
+ * Update remotes
2295
+ *
2296
+ * Wraps: `git remote update`
2297
+ */
2298
+ update(remotes?: Array<string>, opts?: RemoteUpdateOpts & ExecOpts): Promise<void>;
2299
+ /**
2300
+ * Set tracked branches for a remote
2301
+ *
2302
+ * Wraps: `git remote set-branches <remote> <branch>...`
2303
+ */
2304
+ setBranches(remote: string, branches: Array<string>, opts?: RemoteSetBranchesOpts & ExecOpts): Promise<void>;
924
2305
  }
925
2306
  /**
926
2307
  * Config entry
@@ -937,6 +2318,10 @@ export type ConfigEntry = {
937
2318
  export type ConfigGetOpts = {
938
2319
  /** Get all values for multi-valued key */
939
2320
  all?: boolean;
2321
+ /** Type to interpret the value as */
2322
+ type?: 'bool' | 'int' | 'bool-or-int' | 'path' | 'expiry-date' | 'color';
2323
+ /** Default value to use if the key is not set */
2324
+ default?: string;
940
2325
  };
941
2326
  /**
942
2327
  * Options for config set
@@ -953,6 +2338,10 @@ export type ConfigListOpts = {
953
2338
  showOrigin?: boolean;
954
2339
  /** Show scope of each value */
955
2340
  showScope?: boolean;
2341
+ /** Respect include directives */
2342
+ includes?: boolean;
2343
+ /** Only show config key names */
2344
+ nameOnly?: boolean;
956
2345
  };
957
2346
  /**
958
2347
  * Well-known git config keys with their expected value types
@@ -1014,106 +2403,233 @@ export type ConfigSchema = {
1014
2403
  */
1015
2404
  export type ConfigKey = keyof ConfigSchema;
1016
2405
  /**
1017
- * Config operations interface (repository-level)
2406
+ * Config operations (repository-level)
2407
+ *
2408
+ * Wraps: `git config` subcommands
1018
2409
  */
1019
2410
  export interface ConfigOperations {
1020
2411
  /**
1021
2412
  * Get a typed config value
1022
- * Returns undefined if not set
2413
+ *
2414
+ * Wraps: `git config --get <key>`
2415
+ *
2416
+ * @returns Config value or undefined if not set
1023
2417
  */
1024
2418
  get<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<ConfigSchema[K] | undefined>;
1025
2419
  /**
1026
- * Get a typed config value with all option (for multi-valued keys)
2420
+ * Get all values for a multi-valued config key
2421
+ *
2422
+ * Wraps: `git config --get-all <key>`
1027
2423
  */
1028
2424
  getAll<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<Array<ConfigSchema[K]>>;
1029
2425
  /**
1030
2426
  * Set a typed config value
2427
+ *
2428
+ * Wraps: `git config <key> <value>`
1031
2429
  */
1032
2430
  set<K extends ConfigKey>(key: K, value: ConfigSchema[K], opts?: ExecOpts): Promise<void>;
1033
2431
  /**
1034
2432
  * Add a value to a multi-valued config key
2433
+ *
2434
+ * Wraps: `git config --add <key> <value>`
1035
2435
  */
1036
2436
  add<K extends ConfigKey>(key: K, value: ConfigSchema[K], opts?: ExecOpts): Promise<void>;
1037
2437
  /**
1038
2438
  * Unset a typed config value
2439
+ *
2440
+ * Wraps: `git config --unset <key>`
1039
2441
  */
1040
2442
  unset<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<void>;
1041
2443
  /**
1042
2444
  * Get a raw config value (for arbitrary keys)
1043
- * Returns undefined if not set
2445
+ *
2446
+ * Wraps: `git config --get <key>`
2447
+ *
2448
+ * @returns Config value or undefined if not set
1044
2449
  */
1045
2450
  getRaw(key: string, opts?: ConfigGetOpts & ExecOpts): Promise<string | Array<string> | undefined>;
1046
2451
  /**
1047
2452
  * Set a raw config value (for arbitrary keys)
2453
+ *
2454
+ * Wraps: `git config <key> <value>`
1048
2455
  */
1049
2456
  setRaw(key: string, value: string, opts?: ConfigSetOpts & ExecOpts): Promise<void>;
1050
2457
  /**
1051
2458
  * Unset a raw config value (for arbitrary keys)
2459
+ *
2460
+ * Wraps: `git config --unset <key>`
1052
2461
  */
1053
2462
  unsetRaw(key: string, opts?: ExecOpts): Promise<void>;
1054
2463
  /**
1055
2464
  * List all config values
2465
+ *
2466
+ * Wraps: `git config --list`
1056
2467
  */
1057
2468
  list(opts?: ConfigListOpts & ExecOpts): Promise<Array<ConfigEntry>>;
2469
+ /**
2470
+ * Rename a config section
2471
+ *
2472
+ * Wraps: `git config --rename-section <old> <new>`
2473
+ */
2474
+ renameSection(oldName: string, newName: string, opts?: ExecOpts): Promise<void>;
2475
+ /**
2476
+ * Remove a config section
2477
+ *
2478
+ * Wraps: `git config --remove-section <name>`
2479
+ */
2480
+ removeSection(name: string, opts?: ExecOpts): Promise<void>;
1058
2481
  }
1059
2482
  /**
1060
- * Submodule operations interface
2483
+ * Submodule operations
2484
+ *
2485
+ * Wraps: `git submodule` subcommands
1061
2486
  */
1062
2487
  export interface SubmoduleOperations {
1063
2488
  /**
1064
2489
  * List submodules
2490
+ *
2491
+ * Wraps: `git submodule status`
1065
2492
  */
1066
2493
  list(opts?: ExecOpts): Promise<Array<SubmoduleInfo>>;
1067
2494
  /**
1068
2495
  * Initialize submodules
2496
+ *
2497
+ * Wraps: `git submodule init`
1069
2498
  */
1070
2499
  init(paths?: Array<string>, opts?: ExecOpts): Promise<void>;
1071
2500
  /**
1072
2501
  * Update submodules
2502
+ *
2503
+ * Wraps: `git submodule update`
1073
2504
  */
1074
2505
  update(opts?: SubmoduleOpts & ExecOpts): Promise<void>;
1075
2506
  /**
1076
2507
  * Add a submodule
2508
+ *
2509
+ * Wraps: `git submodule add <url> <path>`
1077
2510
  */
1078
- add(url: string, path: string, opts?: ExecOpts): Promise<void>;
2511
+ add(url: string, path: string, opts?: SubmoduleAddOpts & ExecOpts): Promise<void>;
1079
2512
  /**
1080
2513
  * Deinitialize a submodule
2514
+ *
2515
+ * Wraps: `git submodule deinit <path>`
2516
+ */
2517
+ deinit(path: string, opts?: SubmoduleDeinitOpts & ExecOpts): Promise<void>;
2518
+ /**
2519
+ * Get submodule status
2520
+ *
2521
+ * Wraps: `git submodule status`
2522
+ */
2523
+ status(paths?: Array<string>, opts?: SubmoduleStatusOpts & ExecOpts): Promise<string>;
2524
+ /**
2525
+ * Get submodule summary
2526
+ *
2527
+ * Wraps: `git submodule summary`
1081
2528
  */
1082
- deinit(path: string, opts?: ExecOpts): Promise<void>;
2529
+ summary(opts?: SubmoduleSummaryOpts & ExecOpts): Promise<string>;
2530
+ /**
2531
+ * Run a command in each submodule
2532
+ *
2533
+ * Wraps: `git submodule foreach <command>`
2534
+ */
2535
+ foreach(command: string, opts?: SubmoduleForeachOpts & ExecOpts): Promise<string>;
2536
+ /**
2537
+ * Sync submodule URL configuration
2538
+ *
2539
+ * Wraps: `git submodule sync`
2540
+ */
2541
+ sync(paths?: Array<string>, opts?: SubmoduleSyncOpts & ExecOpts): Promise<void>;
2542
+ /**
2543
+ * Absorb git directories of submodules into the superproject
2544
+ *
2545
+ * Wraps: `git submodule absorbgitdirs`
2546
+ */
2547
+ absorbGitDirs(opts?: ExecOpts): Promise<void>;
2548
+ /**
2549
+ * Set the branch for a submodule
2550
+ *
2551
+ * Wraps: `git submodule set-branch --branch <branch> -- <path>`
2552
+ */
2553
+ setBranch(path: string, branch: string, opts?: SubmoduleSetBranchOpts & ExecOpts): Promise<void>;
2554
+ /**
2555
+ * Set the URL for a submodule
2556
+ *
2557
+ * Wraps: `git submodule set-url -- <path> <url>`
2558
+ */
2559
+ setUrl(path: string, url: string, opts?: ExecOpts): Promise<void>;
1083
2560
  }
1084
2561
  /**
1085
- * Worktree repository with full working directory support
2562
+ * Repository with working directory
2563
+ *
2564
+ * Provides type-safe wrappers for Git commands that operate on repositories
2565
+ * with a working tree. Each method corresponds to a specific Git CLI command
2566
+ * or subcommand.
1086
2567
  */
1087
2568
  export interface WorktreeRepo extends RepoBase {
2569
+ /** Path to the working directory */
1088
2570
  readonly workdir: string;
1089
2571
  /**
1090
2572
  * Get repository status
2573
+ *
2574
+ * Wraps: `git status`
2575
+ *
2576
+ * @example
2577
+ * ```typescript
2578
+ * const status = await repo.status();
2579
+ * console.log(status.entries); // Changed files
2580
+ * console.log(status.branch); // Current branch
2581
+ * ```
1091
2582
  */
1092
2583
  status(opts?: StatusOpts & ExecOpts): Promise<StatusPorcelain>;
1093
2584
  /**
1094
2585
  * Get commit log
2586
+ *
2587
+ * Wraps: `git log`
2588
+ *
2589
+ * @example
2590
+ * ```typescript
2591
+ * const commits = await repo.log({ maxCount: 10 });
2592
+ * ```
1095
2593
  */
1096
2594
  log(opts?: LogOpts & ExecOpts): Promise<Array<Commit>>;
1097
2595
  /**
1098
2596
  * Fetch from remote
2597
+ *
2598
+ * Wraps: `git fetch`
2599
+ *
2600
+ * @example
2601
+ * ```typescript
2602
+ * await repo.fetch({ remote: 'origin', prune: true });
2603
+ * ```
1099
2604
  */
1100
2605
  fetch(opts?: FetchOpts & ExecOpts): Promise<void>;
1101
2606
  /**
1102
2607
  * Push to remote
2608
+ *
2609
+ * Wraps: `git push`
2610
+ *
2611
+ * @example
2612
+ * ```typescript
2613
+ * await repo.push({ remote: 'origin', refspec: 'main' });
2614
+ * ```
1103
2615
  */
1104
2616
  push(opts?: PushOpts & ExecOpts): Promise<void>;
1105
2617
  /**
1106
- * LFS operations
2618
+ * Git LFS operations
2619
+ *
2620
+ * Wraps: `git lfs *` commands
1107
2621
  */
1108
2622
  lfs: LfsOperations;
1109
2623
  /**
1110
- * LFS extra operations (inspired by fs-extra)
2624
+ * Git LFS extra operations (inspired by fs-extra)
1111
2625
  *
1112
2626
  * Additional utilities for advanced LFS patterns like 2-phase commit/fetch.
1113
2627
  */
1114
2628
  lfsExtra: LfsExtraOperations;
1115
2629
  /**
1116
- * Worktree operations (§7.4)
2630
+ * Git worktree operations
2631
+ *
2632
+ * Wraps: `git worktree *` commands
1117
2633
  */
1118
2634
  worktree: WorktreeOperations;
1119
2635
  /**
@@ -1122,83 +2638,237 @@ export interface WorktreeRepo extends RepoBase {
1122
2638
  setLfsMode(mode: LfsMode): void;
1123
2639
  /**
1124
2640
  * Add files to the index
2641
+ *
2642
+ * Wraps: `git add`
2643
+ *
2644
+ * @example
2645
+ * ```typescript
2646
+ * await repo.add(['file1.txt', 'file2.txt']);
2647
+ * await repo.add('.', { all: true });
2648
+ * ```
1125
2649
  */
1126
2650
  add(paths: string | Array<string>, opts?: AddOpts & ExecOpts): Promise<void>;
1127
2651
  /**
1128
- * Branch operations
2652
+ * Git branch operations
2653
+ *
2654
+ * Wraps: `git branch *` commands
1129
2655
  */
1130
2656
  branch: BranchOperations;
1131
2657
  /**
1132
- * Checkout a branch, tag, or commit
2658
+ * Checkout a branch, tag, or commit (branch switching mode)
2659
+ *
2660
+ * Wraps: `git checkout <branch>`
2661
+ *
2662
+ * @example
2663
+ * ```typescript
2664
+ * await repo.checkout('main');
2665
+ * await repo.checkout('feature', { createBranch: true });
2666
+ * await repo.checkout('feature', { createBranch: true, startPoint: 'origin/main' });
2667
+ * ```
2668
+ */
2669
+ checkout(target: string, opts?: CheckoutBranchOpts & ExecOpts): Promise<void>;
2670
+ /**
2671
+ * Checkout specific files from a tree-ish (pathspec mode)
2672
+ *
2673
+ * Wraps: `git checkout [<tree-ish>] -- <pathspec>...`
2674
+ *
2675
+ * @example
2676
+ * ```typescript
2677
+ * // Restore file from index (discard working tree changes)
2678
+ * await repo.checkout(['file.txt']);
2679
+ *
2680
+ * // Restore file from HEAD
2681
+ * await repo.checkout(['file.txt'], { source: 'HEAD' });
2682
+ *
2683
+ * // Restore file from specific commit
2684
+ * await repo.checkout(['src/'], { source: 'abc123' });
2685
+ *
2686
+ * // Resolve conflict with ours/theirs
2687
+ * await repo.checkout(['conflicted.txt'], { ours: true });
2688
+ * ```
1133
2689
  */
1134
- checkout(target: string, opts?: CheckoutOpts & ExecOpts): Promise<void>;
2690
+ checkout(paths: Array<string>, opts?: CheckoutPathOpts & ExecOpts): Promise<void>;
1135
2691
  /**
1136
2692
  * Create a commit
2693
+ *
2694
+ * Wraps: `git commit`
2695
+ *
2696
+ * @example
2697
+ * ```typescript
2698
+ * const result = await repo.commit({ message: 'feat: add new feature' });
2699
+ * console.log(result.hash);
2700
+ * ```
1137
2701
  */
1138
2702
  commit(opts?: CommitOpts & ExecOpts): Promise<CommitResult>;
1139
2703
  /**
1140
2704
  * Show changes between commits, commit and working tree, etc.
2705
+ *
2706
+ * Wraps: `git diff`
2707
+ *
2708
+ * @example
2709
+ * ```typescript
2710
+ * const diff = await repo.diff('HEAD~1');
2711
+ * const staged = await repo.diff({ staged: true });
2712
+ * ```
1141
2713
  */
1142
2714
  diff(target?: string, opts?: DiffOpts & ExecOpts): Promise<DiffResult>;
1143
2715
  /**
1144
2716
  * Merge branches
2717
+ *
2718
+ * Wraps: `git merge`
2719
+ *
2720
+ * @example
2721
+ * ```typescript
2722
+ * const result = await repo.merge('feature-branch');
2723
+ * ```
1145
2724
  */
1146
2725
  merge(branch: string, opts?: MergeOpts & ExecOpts): Promise<MergeResult>;
1147
2726
  /**
1148
2727
  * Pull from remote (fetch + merge/rebase)
2728
+ *
2729
+ * Wraps: `git pull`
2730
+ *
2731
+ * @example
2732
+ * ```typescript
2733
+ * await repo.pull({ remote: 'origin', rebase: true });
2734
+ * ```
1149
2735
  */
1150
2736
  pull(opts?: PullOpts & ExecOpts): Promise<void>;
1151
2737
  /**
1152
2738
  * Reset current HEAD to the specified state
2739
+ *
2740
+ * Wraps: `git reset`
2741
+ *
2742
+ * @example
2743
+ * ```typescript
2744
+ * await repo.reset('HEAD~1', { hard: true });
2745
+ * await repo.reset({ soft: true });
2746
+ * ```
1153
2747
  */
1154
2748
  reset(target?: string, opts?: ResetOpts & ExecOpts): Promise<void>;
1155
2749
  /**
1156
2750
  * Remove files from the working tree and from the index
2751
+ *
2752
+ * Wraps: `git rm`
2753
+ *
2754
+ * @example
2755
+ * ```typescript
2756
+ * await repo.rm('file.txt');
2757
+ * await repo.rm('dir/', { recursive: true });
2758
+ * ```
1157
2759
  */
1158
2760
  rm(paths: string | Array<string>, opts?: RmOpts & ExecOpts): Promise<void>;
1159
2761
  /**
1160
- * Stash operations
2762
+ * Git stash operations
2763
+ *
2764
+ * Wraps: `git stash *` commands
1161
2765
  */
1162
2766
  stash: StashOperations;
1163
2767
  /**
1164
2768
  * Switch branches
2769
+ *
2770
+ * Wraps: `git switch`
2771
+ *
2772
+ * @example
2773
+ * ```typescript
2774
+ * await repo.switch('main');
2775
+ * await repo.switch('new-branch', { create: true });
2776
+ * ```
1165
2777
  */
1166
2778
  switch(branch: string, opts?: SwitchOpts & ExecOpts): Promise<void>;
1167
2779
  /**
1168
- * Tag operations
2780
+ * Git tag operations
2781
+ *
2782
+ * Wraps: `git tag *` commands
1169
2783
  */
1170
2784
  tag: TagOperations;
1171
2785
  /**
1172
- * Cherry-pick commits
2786
+ * Apply changes from existing commits
2787
+ *
2788
+ * Wraps: `git cherry-pick`
2789
+ *
2790
+ * @example
2791
+ * ```typescript
2792
+ * await repo.cherryPick('abc123');
2793
+ * await repo.cherryPick(['abc123', 'def456']);
2794
+ * ```
1173
2795
  */
1174
2796
  cherryPick(commits: string | Array<string>, opts?: CherryPickOpts & ExecOpts): Promise<void>;
1175
2797
  /**
1176
- * Clean untracked files
2798
+ * Remove untracked files from the working tree
2799
+ *
2800
+ * Wraps: `git clean`
2801
+ *
2802
+ * @example
2803
+ * ```typescript
2804
+ * const removed = await repo.clean({ force: true, directories: true });
2805
+ * ```
1177
2806
  */
1178
2807
  clean(opts?: CleanOpts & ExecOpts): Promise<Array<string>>;
1179
2808
  /**
1180
2809
  * Move or rename files
2810
+ *
2811
+ * Wraps: `git mv`
2812
+ *
2813
+ * @example
2814
+ * ```typescript
2815
+ * await repo.mv('old-name.txt', 'new-name.txt');
2816
+ * ```
1181
2817
  */
1182
2818
  mv(source: string, destination: string, opts?: MvOpts & ExecOpts): Promise<void>;
1183
2819
  /**
1184
- * Rebase commits
2820
+ * Reapply commits on top of another base
2821
+ *
2822
+ * Wraps: `git rebase`
2823
+ *
2824
+ * @example
2825
+ * ```typescript
2826
+ * await repo.rebase({ onto: 'main' });
2827
+ * await repo.rebase({ abort: true });
2828
+ * ```
1185
2829
  */
1186
2830
  rebase(opts?: RebaseOpts & ExecOpts): Promise<void>;
1187
2831
  /**
1188
2832
  * Restore working tree files
2833
+ *
2834
+ * Wraps: `git restore`
2835
+ *
2836
+ * @example
2837
+ * ```typescript
2838
+ * await repo.restore(['file.txt'], { staged: true });
2839
+ * await repo.restore(['.'], { source: 'HEAD' });
2840
+ * ```
1189
2841
  */
1190
2842
  restore(paths: string | Array<string>, opts?: RestoreOpts & ExecOpts): Promise<void>;
1191
2843
  /**
1192
- * Revert commits
2844
+ * Revert existing commits
2845
+ *
2846
+ * Wraps: `git revert`
2847
+ *
2848
+ * @example
2849
+ * ```typescript
2850
+ * await repo.revert('abc123');
2851
+ * await repo.revert(['abc123', 'def456'], { noCommit: true });
2852
+ * ```
1193
2853
  */
1194
2854
  revert(commits: string | Array<string>, opts?: RevertOpts & ExecOpts): Promise<void>;
1195
2855
  /**
1196
2856
  * Show various types of objects
2857
+ *
2858
+ * Wraps: `git show`
2859
+ *
2860
+ * @example
2861
+ * ```typescript
2862
+ * const content = await repo.show('HEAD:README.md');
2863
+ * const commitInfo = await repo.show('abc123');
2864
+ * ```
1197
2865
  */
1198
2866
  show(object: string, opts?: ShowOpts & ExecOpts): Promise<string>;
1199
2867
  /**
1200
2868
  * Parse revision specification and return the object name (SHA)
1201
2869
  *
2870
+ * Wraps: `git rev-parse`
2871
+ *
1202
2872
  * Useful for resolving refs like HEAD, branch names, or relative refs like HEAD~1
1203
2873
  *
1204
2874
  * @example
@@ -1212,7 +2882,7 @@ export interface WorktreeRepo extends RepoBase {
1212
2882
  /**
1213
2883
  * Count the number of commits reachable from a ref
1214
2884
  *
1215
- * Equivalent to `git rev-list --count <ref>`
2885
+ * Wraps: `git rev-list --count`
1216
2886
  *
1217
2887
  * @example
1218
2888
  * ```typescript
@@ -1224,6 +2894,8 @@ export interface WorktreeRepo extends RepoBase {
1224
2894
  /**
1225
2895
  * Read or modify symbolic refs
1226
2896
  *
2897
+ * Wraps: `git symbolic-ref`
2898
+ *
1227
2899
  * Without newRef: reads the symbolic ref (e.g., get what HEAD points to)
1228
2900
  * With newRef: sets the symbolic ref to point to newRef
1229
2901
  *
@@ -1238,37 +2910,55 @@ export interface WorktreeRepo extends RepoBase {
1238
2910
  */
1239
2911
  symbolicRef(name: string, newRef?: string, opts?: ExecOpts): Promise<string | undefined>;
1240
2912
  /**
1241
- * Submodule operations
2913
+ * Git submodule operations
2914
+ *
2915
+ * Wraps: `git submodule *` commands
1242
2916
  */
1243
2917
  submodule: SubmoduleOperations;
1244
2918
  /**
1245
- * Remote operations
2919
+ * Git remote operations
2920
+ *
2921
+ * Wraps: `git remote *` commands
1246
2922
  */
1247
2923
  remote: RemoteOperations;
1248
2924
  /**
1249
- * Config operations (repository-level)
2925
+ * Git config operations (repository-level)
2926
+ *
2927
+ * Wraps: `git config` (without --global)
1250
2928
  */
1251
2929
  config: ConfigOperations;
1252
2930
  }
1253
2931
  /**
1254
2932
  * Bare repository (no working directory)
2933
+ *
2934
+ * A bare repository contains only the Git data without a working tree.
2935
+ * Typically used for shared/server repositories.
1255
2936
  */
1256
2937
  export interface BareRepo extends RepoBase {
2938
+ /** Path to the git directory */
1257
2939
  readonly gitDir: string;
1258
2940
  /**
1259
2941
  * Fetch from remote
2942
+ *
2943
+ * Wraps: `git fetch`
1260
2944
  */
1261
2945
  fetch(opts?: FetchOpts & ExecOpts): Promise<void>;
1262
2946
  /**
1263
2947
  * Push to remote
2948
+ *
2949
+ * Wraps: `git push`
1264
2950
  */
1265
2951
  push(opts?: PushOpts & ExecOpts): Promise<void>;
1266
2952
  /**
1267
2953
  * Remote operations
2954
+ *
2955
+ * Wraps: `git remote` subcommands
1268
2956
  */
1269
2957
  remote: RemoteOperations;
1270
2958
  /**
1271
2959
  * Config operations (repository-level)
2960
+ *
2961
+ * Wraps: `git config` subcommands
1272
2962
  */
1273
2963
  config: ConfigOperations;
1274
2964
  }