@peiyanlu/git-utils 0.0.0-stage → 0.0.1

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 YanluPei
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,24 @@
1
- # Temporary Holding Version
1
+ # @peiyanlu/git-utils
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+
4
+ [![module](https://img.shields.io/badge/package-ESM--only-FFE536.svg?logo=npm)](https://nodejs.org/api/esm.html)
5
+ [![npm](https://img.shields.io/npm/v/@peiyanlu/git-utils.svg)](https://npmjs.com/package/@peiyanlu/git-utils)
6
+ [![license](https://img.shields.io/npm/l/@peiyanlu/git-utils.svg)](https://npmjs.com/package/@peiyanlu/git-utils)
7
+ [![downloads](https://img.shields.io/npm/dm/@peiyanlu/git-utils.svg)](https://npmjs.com/package/@peiyanlu/git-utils)
8
+ [![node](https://img.shields.io/node/v/@peiyanlu/git-utils.svg)](https://nodejs.org)
9
+ [![size](https://packagephobia.com/badge?p=@peiyanlu/git-utils)](https://packagephobia.com/result?p=@peiyanlu/git-utils)
10
+ [![deps](https://img.shields.io/librariesio/release/npm/@peiyanlu/git-utils)](https://libraries.io/npm/%40peiyanlu%2Fgit-utils)
11
+
12
+ A Node.js and TypeScript library for common Git commands and workflows.
13
+
14
+ ## Installation
15
+
16
+ ```shell
17
+ pnpm add @peiyanlu/git-utils
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```ts
23
+ import { gitAdd, gitCommit, gitPush } from '@peiyanlu/git-utils'
24
+ ```
@@ -0,0 +1,607 @@
1
+ import { CommandOutput, SpawnAsyncOpts, SpawnSyncOpts } from "@peiyanlu/command-utils";
2
+ /**
3
+ * 暂存所有文件
4
+ * @defaults `git add --all`
5
+ */
6
+ export declare const gitAddAll: (args?: string[]) => Promise<void>;
7
+ /**
8
+ * 暂存已追踪文件
9
+ * @defaults `git add --update`
10
+ */
11
+ export declare const gitAddTracked: (args?: string[]) => Promise<void>;
12
+ /**
13
+ * 获取当前分支
14
+ * @defaults `git branch --show-current`
15
+ * */
16
+ export declare const gitBranchCurrent: () => Promise<string>;
17
+ /**
18
+ * 重命名本地分支
19
+ * @defaults `git branch -m <old-name> <new-name>`
20
+ */
21
+ export declare const gitBranchMove: (oldName: string, newName: string) => Promise<void>;
22
+ /**
23
+ * 重命名本地分支(强制)
24
+ * @defaults `git branch -M <old-name> <new-name>`
25
+ */
26
+ export declare const gitBranchMoveForce: (oldName: string, newName: string) => Promise<void>;
27
+ /**
28
+ * 删除本地分支
29
+ * @defaults `git branch -d <branch>`
30
+ */
31
+ export declare const gitBranchDelete: (branch: string) => Promise<void>;
32
+ /**
33
+ * 删除本地分支(强制)
34
+ * @defaults `git branch -D <branch>`
35
+ */
36
+ export declare const gitBranchDeleteForce: (branch: string) => Promise<void>;
37
+ /** 获取所有分支 */
38
+ export declare const getLocalBranches: () => Promise<string[]>;
39
+ export declare const getRemoteBranches: () => Promise<string[]>;
40
+ /**
41
+ * 创建并签出
42
+ * @defaults `git checkout -b <branch> <start-point>`
43
+ * @fallback `git checkout <branch>`
44
+ * @see
45
+ * ```
46
+ * git branch <branch> <start-point>
47
+ * git checkout <branch>
48
+ * ```
49
+ */
50
+ export declare const gitCheckoutBranch: (branch: string, startpoint?: string) => Promise<void>;
51
+ /**
52
+ * 强制创建/重置并签出
53
+ * @defaults `git checkout -B <branch> <start-point>`
54
+ * @see
55
+ * ```
56
+ * git checkout <start-point>
57
+ * git branch -f <branch> HEAD
58
+ * git checkout <branch>
59
+ * ```
60
+ */
61
+ export declare const gitCheckoutBranchForce: (branch: string, startpoint?: string) => Promise<void>;
62
+ /**
63
+ * 创建孤儿分支
64
+ * @defaults `git checkout --orphan <branch>`
65
+ */
66
+ export declare const gitCheckoutBranchOrphan: (branch: string, startpoint?: string) => Promise<void>;
67
+ /**
68
+ * 提交
69
+ * @defaults `git commit --message message <args>`
70
+ */
71
+ export declare const gitCommitMessage: (message: string, args?: string[]) => Promise<void>;
72
+ /**
73
+ * 空内容提交
74
+ * @defaults `git commit --message message --allow-empty <args>`
75
+ */
76
+ export declare const gitCommitAllowEmpty: (message: string, args?: string[]) => Promise<void>;
77
+ /**
78
+ * 修正提交
79
+ * @defaults `git commit --message message --amend <args>`
80
+ */
81
+ export declare const gitCommitAmend: (message: string, args?: string[]) => Promise<void>;
82
+ /**
83
+ * 修正提交 保留信息
84
+ * @defaults `git commit --amend --no-edit <args>`
85
+ */
86
+ export declare const gitCommitAmendNoEdit: (args?: string[]) => Promise<void>;
87
+ /**
88
+ * 获取指定的 git 配置
89
+ * @defaults `git config [--global] --get <key>`
90
+ */
91
+ export declare const gitConfigGet: (key: string, global?: boolean) => Promise<string | undefined>;
92
+ /**
93
+ * 指定的 git 配置
94
+ * @defaults `git config [--global] <key> <value>`
95
+ */
96
+ export declare const gitConfigSet: (key: string, value: string, global?: boolean) => Promise<void>;
97
+ /**
98
+ * 移除指定配置
99
+ * @defaults `git config [--global] --unset <key>`
100
+ */
101
+ export declare const gitConfigUnset: (key: string, global?: boolean) => Promise<void>;
102
+ /**
103
+ * 配置列表
104
+ * @defaults `git config [--global] --list`
105
+ */
106
+ export declare const gitConfigList: (global?: boolean) => Promise<string | undefined>;
107
+ /**
108
+ * 推送 tag 到远程
109
+ * @defaults `git push <remote> refs/tags/<tag> <args>`
110
+ */
111
+ export declare const gitPushTag: (remote: string, tag: string, args?: string[]) => Promise<void>;
112
+ /**
113
+ * 推送分支到远程
114
+ * 自动处理 upstream
115
+ * @defaults `git push <remote> <branch> [--set-upstream] <args>`
116
+ */
117
+ export declare const gitPushBranch: (remote: string, branch: string, args?: string[]) => Promise<void>;
118
+ /**
119
+ * 删除远程引用(分支、tag)
120
+ * @defaults `git push <remote> <ref> --delete <args>`
121
+ */
122
+ export declare const gitPushDeleteRef: (remote: string, ref: string, args?: string[]) => Promise<void>;
123
+ /**
124
+ * 获取 url
125
+ * @defaults `git remote get-url <args>`
126
+ */
127
+ export declare const gitRemoteGetUrl: (args: string[]) => Promise<string | undefined>;
128
+ /**
129
+ * 设置 url
130
+ * @defaults `git remote set-url <args>`
131
+ */
132
+ export declare const gitRemoteSetUrl: (args: string[]) => Promise<void>;
133
+ /**
134
+ * 添加远程
135
+ * @defaults `git remote add <name> <url>`
136
+ */
137
+ export declare const gitRemoteAdd: (name: string, url: string) => Promise<void>;
138
+ /**
139
+ * 重命名远程
140
+ * @defaults `git remote rename <old-name> <new-name>`
141
+ */
142
+ export declare const gitRemoteRename: (oldName: string, newName: string) => Promise<void>;
143
+ /**
144
+ * 移除远程
145
+ * @defaults `git remote remove <name>`
146
+ */
147
+ export declare const gitRemoteRemove: (name: string) => Promise<void>;
148
+ /** 获取关联的所有远程 */
149
+ export declare const getRemoteNames: () => Promise<string[]>;
150
+ /** 获取远程地址 */
151
+ export declare const getRemoteUrl: (remote: string) => Promise<string | undefined>;
152
+ /** 获取所有远程 */
153
+ export declare const getRemoteList: () => Promise<{
154
+ name: string;
155
+ url?: string;
156
+ }[]>;
157
+ /**
158
+ * 创建 lightweight tag
159
+ * @defaults `git tag <tag> <args>`
160
+ */
161
+ export declare const gitTagLightweight: (tag: string, args?: string[]) => Promise<void>;
162
+ /**
163
+ * 创建 annotated tag
164
+ * @defaults `git tag --annotate --message <msg> <tag> <args>`
165
+ */
166
+ export declare const gitTagAnnotated: (tag: string, message?: string, args?: string[]) => Promise<void>;
167
+ /**
168
+ * 创建 signed tag
169
+ * @defaults `git tag --sign --message <msg> <tag> <args>`
170
+ */
171
+ export declare const gitTagSigned: (tag: string, message?: string, args?: string[]) => Promise<void>;
172
+ /**
173
+ * 删除本地 tag
174
+ * @defaults `git tag --delete <tag> <args>`
175
+ */
176
+ export declare const gitTagDelete: (tag: string, args?: string[]) => Promise<void>;
177
+ /** {@link gitTagDelete} 的同步版本 */
178
+ export declare const gitTagDeleteSync: (tag: string, args?: string[]) => void;
179
+ export type SortKey = "v:refname" | "creatordate";
180
+ export type GitSort = SortKey | `-${SortKey}`;
181
+ export declare enum GitSorter {
182
+ NAME_ASC = "v:refname",
183
+ NAME_DESC = "-v:refname",
184
+ DATE_ASC = "creatordate",
185
+ DATE_DESC = "-creatordate"
186
+ }
187
+ /**
188
+ * 获取本地所有 tag
189
+ * @defaults `git for-each-ref refs/tags/<match> --format "%(refname:short)" --sort <sort>
190
+ * --exclude refs/tags/<match> --count <count>`
191
+ */
192
+ export declare const getLocalTags: (match?: string, exclude?: string | string[], sort?: GitSort, count?: number) => Promise<string[]>;
193
+ /**
194
+ * 获取远程所有 tag
195
+ * @defaults `git ls-remote --tags --refs --sort <sort> <remote>`
196
+ */
197
+ export declare const getRemoteTags: (remote?: string, sort?: GitSort) => Promise<string[]>;
198
+ /** 获取最新 tag */
199
+ export declare const getLatestTag: (match?: string, exclude?: string | string[]) => Promise<string>;
200
+ /** 获取上一个 tag */
201
+ export declare const getPreviousTag: (tag: string, match?: string, exclude?: string | string[]) => Promise<string>;
202
+ /**
203
+ * 安全撤销一个已提交(并可能已 push)的 commit
204
+ * @defaults `git revert <commit>`
205
+ */
206
+ export declare const gitRevertCommit: (hash: string) => Promise<void>;
207
+ /** 初始化裸仓库,模拟远程仓库 */
208
+ export declare const initBareRepo: (dir: string) => Promise<void>;
209
+ /** 初始化仓库 */
210
+ export declare const initRepo: (branch?: string) => Promise<void>;
211
+ /** 判断指定目录是否是 git 仓库 */
212
+ export declare const isGitRepo: (dir?: string) => Promise<boolean>;
213
+ /** 判断指定目录是否是 git 裸仓库 */
214
+ export declare const isGitBareRepo: (dir?: string) => Promise<boolean>;
215
+ /** 判断工作区是否干净 */
216
+ export declare const isWorkingTreeClean: () => Promise<boolean>;
217
+ /**
218
+ * 判断当前分支是否已设置 upstream
219
+ * @defaults `git rev-parse --abbrev-ref --symbolic-full-name "<branch>@{u}"`
220
+ */
221
+ export declare const hasUpstream: (branch?: string) => Promise<boolean>;
222
+ /**
223
+ * 获取完整 hash
224
+ * @defaults `git rev-parse <rev>`
225
+ */
226
+ export declare const getFullHash: (rev: string) => Promise<string | undefined>;
227
+ /**
228
+ * 获取短 hash
229
+ * @defaults `git rev-parse --short <rev>`
230
+ */
231
+ export declare const getShortHash: (rev: string) => Promise<string | undefined>;
232
+ /**
233
+ * 提取所有分支
234
+ * @defaults `git fetch --all --prune`
235
+ */
236
+ export declare const fetchAllPrune: () => Promise<void>;
237
+ /**
238
+ * 获取当前工作区状态
239
+ * @defaults `git status --short --untracked-files=no`
240
+ */
241
+ export declare const getShortStatus: () => Promise<string | undefined>;
242
+ /**
243
+ * 为 git status / changeset 输出添加颜色
244
+ *
245
+ * M -> 黄色(修改)
246
+ * A -> 绿色(新增)
247
+ * D -> 红色(删除)
248
+ * @param {string} log `git status --short` 输出
249
+ * @returns {string}
250
+ */
251
+ export declare const coloredStatus: (log: string) => string;
252
+ /**
253
+ * 计算 changelog 的 commit 范围
254
+ * @param {boolean} isIncrement 是否为版本递增发布
255
+ * @param {string} match tag match
256
+ * @param {string} exclude tag exclude
257
+ * @returns {Promise<{from: string, to: string}>}
258
+ */
259
+ export declare const resolveChangelogRange: (isIncrement?: boolean, match?: string, exclude?: string | string[]) => Promise<{
260
+ from: string;
261
+ to: string;
262
+ }>;
263
+ /**
264
+ * 获取指定范围内的 commit 日志
265
+ * @defaults `git log --pretty=format:"* %s (%h)" <from>...<to> -- <scope>`
266
+ */
267
+ export declare const getLogSince: (from?: string, to?: string, scope?: string) => Promise<string | undefined>;
268
+ /** 判断字符串是否为合法 remote 名称 */
269
+ export declare const isRemoteName: (remote: string) => Promise<boolean>;
270
+ /** 统计自 tag 以来的提交数量 */
271
+ export declare const countCommitsSince: (tag?: string) => Promise<number>;
272
+ /**
273
+ * 将 HEAD 指向指定分支(不会切换工作区)
274
+ */
275
+ export declare const gitSetHeadBranch: (branch: string) => Promise<void>;
276
+ /** 删除当前分支引用 */
277
+ export declare const gitDeleteHeadRef: () => Promise<void>;
278
+ /**
279
+ * 创建一个没有任何提交的分支状态。
280
+ */
281
+ export declare const createUnbornBranch: (branch: string) => Promise<void>;
282
+ export declare const headArg: (count?: number) => string;
283
+ /**
284
+ * 撤销最近的 commit(移动 HEAD + 取消暂存)
285
+ * - 暂存区被重置到目标 commit
286
+ * - 未提交修改保持不变
287
+ * @defaults `git reset --mixed HEAD~<count>`
288
+ */
289
+ export declare const gitResetMixed: (count?: number) => Promise<void>;
290
+ /**
291
+ * 撤销最近的 commit(完全重置)
292
+ * - 暂存区 + 工作区都会被重置到目标 commit
293
+ * - 未提交修改会丢失
294
+ * @defaults `git reset --hard HEAD~<count>`
295
+ */
296
+ export declare const gitResetHard: (count?: number) => Promise<void>;
297
+ /**
298
+ * 撤销最近的 commit(仅移动 HEAD)
299
+ * - 暂存区保持不变
300
+ * - 未提交修改保持不变
301
+ * @defaults `git reset --soft HEAD~<count>`
302
+ */
303
+ export declare const gitResetSoft: (count?: number) => Promise<void>;
304
+ /**
305
+ * 撤销最近的 commit(安全重置)
306
+ * - 行为类似 --hard
307
+ * - 若会覆盖工作区未提交修改则直接失败
308
+ * @defaults `git reset --keep HEAD~<count>`
309
+ */
310
+ export declare const gitResetKeep: (count?: number) => Promise<void>;
311
+ /** {@link gitResetMixed} 的同步版本 */
312
+ export declare const gitResetMixedSync: (count?: number) => void;
313
+ /** {@link gitResetHard} 的同步版本 */
314
+ export declare const gitResetHardSync: (count?: number) => void;
315
+ /** {@link gitResetSoft} 的同步版本 */
316
+ export declare const gitResetSoftSync: (count?: number) => void;
317
+ /** {@link gitResetKeep} 的同步版本 */
318
+ export declare const gitResetKeepSync: (count?: number) => void;
319
+ /**
320
+ * 用【暂存区】覆盖【工作区】单个文件
321
+ * - 用 Index 覆盖 Working Tree
322
+ * - 不影响暂存区(Index)
323
+ * @defaults `git restore --worktree <file>`
324
+ */
325
+ export declare const gitRestoreFile: (file: string) => Promise<void>;
326
+ /**
327
+ * 用【暂存区】覆盖【工作区】所有文件
328
+ * - 用 Index 覆盖 Working Tree
329
+ * - 不影响暂存区(Index)
330
+ * @defaults `git --worktree restore .`
331
+ */
332
+ export declare const gitRestoreAll: () => Promise<void>;
333
+ /**
334
+ * 用 指定 source 中的文件内容覆盖【工作区】文件
335
+ * - 仅修改 Working Tree
336
+ * - 不影响暂存区(Index)
337
+ * - 不会改变提交历史(HEAD)
338
+ * @defaults `git restore --worktree --source <source> <file>`
339
+ * @see source = `git rev-parse <expr>`
340
+ */
341
+ export declare const gitRestoreWorktreeFileFrom: (source: string, file: string) => Promise<void>;
342
+ /**
343
+ * 用指定 source 中的文件内容覆盖【工作区】所有文件
344
+ * - 仅修改 Working Tree
345
+ * - 不影响暂存区(Index)
346
+ * - 不会改变提交历史(HEAD)
347
+ * @defaults `git restore --worktree --source <source> .`
348
+ * @see source = `git rev-parse <expr>`
349
+ */
350
+ export declare const gitRestoreWorktreeAllFrom: (source: string) => Promise<void>;
351
+ /**
352
+ * 用指定 source 覆盖【暂存区】中的文件
353
+ * - 用 source 覆盖 Index
354
+ * - 不影响工作区(Working Tree)
355
+ * - 不会改变提交历史(HEAD)
356
+ * @defaults `git restore --staged --source <source> <file>`
357
+ * @see source = `git rev-parse <expr>`
358
+ */
359
+ export declare const gitRestoreIndexFileFrom: (source: string, file: string) => Promise<void>;
360
+ /**
361
+ * 用指定 source 覆盖整个【暂存区】
362
+ * - 用 source 覆盖 Index
363
+ * - 不影响工作区(Working Tree)
364
+ * - 不会改变提交历史(HEAD)
365
+ * @defaults `git restore --staged --source <source> .`
366
+ * @see source = `git rev-parse <expr>`
367
+ */
368
+ export declare const gitRestoreIndexAllFrom: (source: string) => Promise<void>;
369
+ /**
370
+ * 用指定 source 覆盖指定文件(暂存区 + 工作区)
371
+ * - 将 Index 和 Working Tree 恢复到 source 状态
372
+ * - 不会移动 HEAD
373
+ * - 不会改变提交历史
374
+ * @defaults `git restore --staged --worktree --source <source> <file>`
375
+ * @see source = `git rev-parse <expr>`
376
+ */
377
+ export declare const gitRestoreFileFrom: (source: string, file: string) => Promise<void>;
378
+ /**
379
+ * 用指定 source 覆盖所有文件(暂存区 + 工作区)
380
+ * - 将 Index 和 Working Tree 恢复到 source 状态
381
+ * - 不会移动 HEAD
382
+ * - 不会改变提交历史
383
+ * @defaults `git restore --staged --worktree --source <source> .`
384
+ * @see source = `git rev-parse <expr>`
385
+ */
386
+ export declare const gitRestoreAllFrom: (source: string) => Promise<void>;
387
+ /**
388
+ * 取消单个文件的暂存状态
389
+ * - 用 HEAD 覆盖暂存区(Index)
390
+ * - 不影响工作区(Working Tree)
391
+ * - 等价于撤销 git add
392
+ * @defaults `git restore --staged <file>`
393
+ */
394
+ export declare const gitUnstageFile: (file: string) => Promise<void>;
395
+ /**
396
+ * 取消所有文件的暂存状态
397
+ * - 用 HEAD 覆盖暂存区(Index)
398
+ * - 不影响工作区(Working Tree)
399
+ * - 等价于撤销所有 git add
400
+ * @defaults `git restore --staged .`
401
+ */
402
+ export declare const gitUnstageAll: () => Promise<void>;
403
+ /**
404
+ * 丢弃指定文件的所有修改(暂存区 + 工作区)
405
+ * - 强制将文件恢复到 HEAD 状态
406
+ * - 同时重置 Index 和 Working Tree
407
+ * - 不会改变提交历史(HEAD)
408
+ * @defaults `git restore --source=HEAD --staged --worktree <file>`
409
+ */
410
+ export declare const gitDiscardFile: (file: string) => Promise<void>;
411
+ /**
412
+ * 丢弃所有文件的所有修改(暂存区 + 工作区)
413
+ * - 强制将整个工作区恢复到 HEAD 状态
414
+ * - 行为等价于 git reset --hard HEAD(按文件粒度)
415
+ * - 不会删除未跟踪文件(untracked files)
416
+ * @defaults `git restore --source=HEAD --staged --worktree .`
417
+ */
418
+ export declare const gitDiscardAll: () => Promise<void>;
419
+ /**
420
+ * 引用解析操作
421
+ * @defaults `git rev-parse <args>`
422
+ */
423
+ export declare const gitRevParse: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
424
+ /** {@link gitRevParse} 的同步版本 */
425
+ export declare const gitRevParseSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
426
+ /**
427
+ * 提交遍历操作
428
+ * @defaults `git rev-list <args>`
429
+ */
430
+ export declare const gitRevList: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
431
+ /** {@link gitRevList} 的同步版本 */
432
+ export declare const gitRevListSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
433
+ /**
434
+ * 引用遍历操作
435
+ * @defaults `git for-each-ref <args>`
436
+ */
437
+ export declare const gitForEachRef: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
438
+ /** {@link gitForEachRef} 的同步版本 */
439
+ export declare const gitForEachRefSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
440
+ /**
441
+ * 暂存操作
442
+ * @defaults `git add <args>`
443
+ */
444
+ export declare const gitAdd: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
445
+ /** {@link gitAdd} 的同步版本 */
446
+ export declare const gitAddSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
447
+ /**
448
+ * 分支操作
449
+ * @defaults `git branch <args>`
450
+ */
451
+ export declare const gitBranch: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
452
+ /** {@link gitBranch} 的同步版本 */
453
+ export declare const gitBranchSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
454
+ /**
455
+ * 迁出操作
456
+ * @defaults `git checkout <args>`
457
+ */
458
+ export declare const gitCheckout: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
459
+ /** {@link gitCheckout} 的同步版本 */
460
+ export declare const gitCheckoutSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
461
+ /**
462
+ * 提交操作
463
+ * @defaults `git commit <args>`
464
+ */
465
+ export declare const gitCommit: (args?: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
466
+ /** {@link gitCommit} 的同步版本 */
467
+ export declare const gitCommitSync: (args?: string[], options?: SpawnSyncOpts) => CommandOutput;
468
+ /**
469
+ * 配置操作
470
+ * @defaults `git config <args>`
471
+ */
472
+ export declare const gitConfig: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
473
+ /** {@link gitConfig} 的同步版本 */
474
+ export declare const gitConfigSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
475
+ /**
476
+ * 符号引用操作
477
+ * @defaults `git symbolic-ref <args>`
478
+ */
479
+ export declare const gitSymbolicRef: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
480
+ /** {@link gitSymbolicRef} 的同步版本 */
481
+ export declare const gitSymbolicRefSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
482
+ /**
483
+ * 引用更新操作
484
+ * @defaults `git update-ref <args>`
485
+ */
486
+ export declare const gitUpdateRef: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
487
+ /** {@link gitUpdateRef} 的同步版本 */
488
+ export declare const gitUpdateRefSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
489
+ /**
490
+ * 推送操作
491
+ * @defaults `git push <args>`
492
+ */
493
+ export declare const gitPush: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
494
+ /** {@link gitPush} 的同步版本 */
495
+ export declare const gitPushSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
496
+ /**
497
+ * 远程操作
498
+ * @defaults `git remote <args>`
499
+ */
500
+ export declare const gitRemote: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
501
+ /** {@link gitRemote} 的同步版本 */
502
+ export declare const gitRemoteSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
503
+ /**
504
+ * tag 操作
505
+ * @defaults `git tag <args>`
506
+ */
507
+ export declare const gitTag: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
508
+ /** {@link gitTag} 的同步版本 */
509
+ export declare const gitTagSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
510
+ /**
511
+ * 重置操作
512
+ * @defaults `git reset <args>`
513
+ */
514
+ export declare const gitReset: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
515
+ /** {@link gitReset} 的同步版本 */
516
+ export declare const gitResetSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
517
+ /**
518
+ * 恢复操作
519
+ * @defaults `git restore <args>`
520
+ */
521
+ export declare const gitRestore: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
522
+ /** {@link gitRestore} 的同步版本 */
523
+ export declare const gitRestoreSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
524
+ /**
525
+ * 回退操作
526
+ * @defaults `git revert <args>`
527
+ */
528
+ export declare const gitRevert: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
529
+ /** {@link gitRevert} 的同步版本 */
530
+ export declare const gitRevertSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
531
+ /**
532
+ * 远程引用查询操作
533
+ * @defaults `git ls-remote <args>`
534
+ */
535
+ export declare const gitLsRemote: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
536
+ /** {@link gitLsRemote} 的同步版本 */
537
+ export declare const gitLsRemoteSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
538
+ /**
539
+ * 状态查询操作
540
+ * @defaults `git status <args>`
541
+ */
542
+ export declare const gitStatus: (args?: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
543
+ /** {@link gitStatus} 的同步版本 */
544
+ export declare const gitStatusSync: (args?: string[], options?: SpawnSyncOpts) => CommandOutput;
545
+ /**
546
+ * 对象查看操作
547
+ * @defaults `git show <args>`
548
+ */
549
+ export declare const gitShow: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
550
+ /** {@link gitShow} 的同步版本 */
551
+ export declare const gitShowSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
552
+ /**
553
+ * 差异比较操作
554
+ * @defaults `git diff <args>`
555
+ */
556
+ export declare const gitDiff: (args?: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
557
+ /** {@link gitDiff} 的同步版本 */
558
+ export declare const gitDiffSync: (args?: string[], options?: SpawnSyncOpts) => CommandOutput;
559
+ /**
560
+ * 暂存区保存操作
561
+ * @defaults `git stash <args>`
562
+ */
563
+ export declare const gitStash: (args?: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
564
+ /** {@link gitStash} 的同步版本 */
565
+ export declare const gitStashSync: (args?: string[], options?: SpawnSyncOpts) => CommandOutput;
566
+ /**
567
+ * 删除文件操作
568
+ * @defaults `git rm <args>`
569
+ */
570
+ export declare const gitRm: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
571
+ /** {@link gitRm} 的同步版本 */
572
+ export declare const gitRmSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
573
+ /**
574
+ * 移动文件操作
575
+ * @defaults `git mv <args>`
576
+ */
577
+ export declare const gitMv: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
578
+ /** {@link gitMv} 的同步版本 */
579
+ export declare const gitMvSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
580
+ /**
581
+ * 对象内容操作
582
+ * @defaults `git cat-file <args>`
583
+ */
584
+ export declare const gitCatFile: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
585
+ /** {@link gitCatFile} 的同步版本 */
586
+ export declare const gitCatFileSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
587
+ /**
588
+ * 日志查询操作
589
+ * @defaults `git log <args>`
590
+ */
591
+ export declare const gitLog: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
592
+ /** {@link gitLog} 的同步版本 */
593
+ export declare const gitLogSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
594
+ /**
595
+ * 仓库初始化操作
596
+ * @defaults `git init <args>`
597
+ */
598
+ export declare const gitInit: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
599
+ /** {@link gitInit} 的同步版本 */
600
+ export declare const gitInitSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;
601
+ /**
602
+ * 获取远程更新操作
603
+ * @defaults `git fetch <args>`
604
+ */
605
+ export declare const gitFetch: (args: string[], options?: SpawnAsyncOpts) => Promise<CommandOutput>;
606
+ /** {@link gitFetch} 的同步版本 */
607
+ export declare const gitFetchSync: (args: string[], options?: SpawnSyncOpts) => CommandOutput;