UNPKG

29.2 kBTypeScriptView Raw
1import * as resp from './response';
2import * as types from './types';
3import { GitError } from './errors';
4
5export interface SimpleGitFactory {
6 (baseDir?: string, options?: Partial<types.SimpleGitOptions>): SimpleGit;
7
8 (baseDir: string): SimpleGit;
9
10 (options: Partial<types.SimpleGitOptions>): SimpleGit;
11}
12
13export type Response<T> = SimpleGit & Promise<T>;
14
15export interface SimpleGitBase {
16 /**
17 * Adds one or more files to source control
18 */
19 add(files: string | string[], callback?: types.SimpleGitTaskCallback<string>): Response<string>;
20
21 /**
22 * Sets the working directory of the subsequent commands.
23 */
24 cwd(directory: { path: string, root?: boolean }, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
25
26 cwd<path extends string>(directory: path, callback?: types.SimpleGitTaskCallback<path>): Response<path>;
27
28 /**
29 * Compute object ID from a file
30 */
31 hashObject(path: string, callback?: types.SimpleGitTaskCallback): Response<string>;
32
33 hashObject(path: string, write ?: boolean, callback?: types.SimpleGitTaskCallback): Response<string>;
34
35 /**
36 * Initialize a git repo
37 */
38 init(bare: boolean, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.InitResult>): Response<resp.InitResult>;
39
40 init(bare: boolean, callback?: types.SimpleGitTaskCallback<resp.InitResult>): Response<resp.InitResult>;
41
42 init(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.InitResult>): Response<resp.InitResult>;
43
44 init(callback?: types.SimpleGitTaskCallback<resp.InitResult>): Response<resp.InitResult>;
45
46 /**
47 * Runs a merge, `options` can be either an array of arguments
48 * supported by the [`git merge`](https://git-scm.com/docs/git-merge)
49 * or an options object.
50 *
51 * Conflicts during the merge result in an error response,
52 * the response type whether it was an error or success will be a MergeSummary instance.
53 * When successful, the MergeSummary has all detail from a the PullSummary
54 *
55 * @see https://github.com/steveukx/git-js/blob/master/src/responses/MergeSummary.js
56 * @see https://github.com/steveukx/git-js/blob/master/src/responses/PullSummary.js
57 */
58 merge(options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.MergeResult>): Response<resp.MergeResult>;
59
60 /**
61 * Merges from one branch to another, equivalent to running `git merge ${remote} ${branch}`, the `options` argument can
62 * either be an array of additional parameters to pass to the command or null / omitted to be ignored.
63 */
64 mergeFromTo<E extends GitError>(remote: string, branch: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.MergeResult, E>): Response<resp.MergeResult>;
65
66 mergeFromTo<E extends GitError>(remote: string, branch: string, callback?: types.SimpleGitTaskCallback<resp.MergeResult, E>): Response<resp.MergeResult>;
67
68 /**
69 * Sets a handler function to be called whenever a new child process is created, the handler function will be called
70 * with the name of the command being run and the stdout & stderr streams used by the ChildProcess.
71 *
72 * @example
73 * require('simple-git')
74 * .outputHandler(function (command, stdout, stderr) {
75 * stdout.pipe(process.stdout);
76 * })
77 * .checkout('https://github.com/user/repo.git');
78 *
79 * @see https://nodejs.org/api/child_process.html#child_process_class_childprocess
80 * @see https://nodejs.org/api/stream.html#stream_class_stream_readable
81 */
82 outputHandler(handler: types.outputHandler | void): this;
83
84 /**
85 * Pushes the current committed changes to a remote, optionally specify the names of the remote and branch to use
86 * when pushing. Supply multiple options as an array of strings in the first argument - see examples below.
87 */
88 push(remote?: string, branch?: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
89
90 push(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
91
92 push(callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
93
94 /**
95 * Stash the local repo
96 */
97 stash(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
98
99 stash(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
100
101 /**
102 * Show the working tree status.
103 */
104 status(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.StatusResult>): Response<resp.StatusResult>;
105
106 status(callback?: types.SimpleGitTaskCallback<resp.StatusResult>): Response<resp.StatusResult>;
107
108}
109
110export interface SimpleGit extends SimpleGitBase {
111
112 /**
113 * Add an annotated tag to the head of the current branch
114 */
115 addAnnotatedTag(tagName: string, tagMessage: string, callback?: types.SimpleGitTaskCallback<{ name: string }>): Response<{ name: string }>;
116
117 /**
118 * Add config to local git instance for the specified `key` (eg: user.name) and value (eg: 'your name').
119 * Set `append` to true to append to rather than overwrite the key
120 */
121 addConfig(key: string, value: string, append?: boolean, scope?: keyof typeof types.GitConfigScope, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
122
123 addConfig(key: string, value: string, append?: boolean, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
124
125 addConfig(key: string, value: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
126
127 /**
128 * Applies a patch to the repo
129 */
130 applyPatch(patches: string | string[], options: types.TaskOptions<types.ApplyOptions>, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
131
132 applyPatch(patches: string | string[], callback?: types.SimpleGitTaskCallback<string>): Response<string>;
133
134 /**
135 * Configuration values visible to git in the current working directory
136 */
137 listConfig(scope: keyof typeof types.GitConfigScope, callback?: types.SimpleGitTaskCallback<resp.ConfigListSummary>): Response<resp.ConfigListSummary>;
138
139 listConfig(callback?: types.SimpleGitTaskCallback<resp.ConfigListSummary>): Response<resp.ConfigListSummary>;
140
141 /**
142 * Adds a remote to the list of remotes.
143 *
144 * - `remoteName` Name of the repository - eg "upstream"
145 * - `remoteRepo` Fully qualified SSH or HTTP(S) path to the remote repo
146 * - `options` Optional additional settings permitted by the `git remote add` command, merged into the command prior to the repo name and remote url
147 */
148 addRemote(remoteName: string, remoteRepo: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
149
150 addRemote(remoteName: string, remoteRepo: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
151
152 /**
153 * Add a lightweight tag to the head of the current branch
154 */
155 addTag(name: string, callback?: types.SimpleGitTaskCallback<{ name: string }>): Response<{ name: string }>;
156
157 /**
158 * Equivalent to `catFile` but will return the native `Buffer` of content from the git command's stdout.
159 */
160 binaryCatFile(options: string[], callback?: types.SimpleGitTaskCallback<any>): Response<any>;
161
162 /**
163 * List all branches
164 */
165 branch(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.BranchSummary>): Response<resp.BranchSummary>;
166
167 /**
168 * List of local branches
169 */
170 branchLocal(callback?: types.SimpleGitTaskCallback<resp.BranchSummary>): Response<resp.BranchSummary>;
171
172 /**
173 * Returns a list of objects in a tree based on commit hash.
174 * Passing in an object hash returns the object's content, size, and type.
175 *
176 * Passing "-p" will instruct cat-file to determine the object type, and display its formatted contents.
177 *
178 * @see https://git-scm.com/docs/git-cat-file
179 */
180 catFile(options: string[], callback?: types.SimpleGitTaskCallback<string>): Response<string>;
181
182 catFile(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
183
184 /**
185 * Check if a pathname or pathnames are excluded by .gitignore
186 *
187 */
188 checkIgnore(pathNames: string[], callback?: types.SimpleGitTaskCallback<string[]>): Response<string[]>;
189
190 checkIgnore(path: string, callback?: types.SimpleGitTaskCallback<string[]>): Response<string[]>;
191
192 /**
193 * Validates that the current working directory is a valid git repo file path.
194 *
195 * To make a more specific assertion of the repo, add the `action` argument:
196 *
197 * - `bare` to validate that the working directory is inside a bare repo.
198 * - `root` to validate that the working directory is the root of a repo.
199 * - `tree` (default value when omitted) to simply validate that the working
200 * directory is the descendent of a repo
201 */
202 checkIsRepo(action?: types.CheckRepoActions, callback?: types.SimpleGitTaskCallback<boolean>): Response<boolean>;
203
204 checkIsRepo(callback?: types.SimpleGitTaskCallback<boolean>): Response<boolean>;
205
206 /**
207 * Checkout a tag or revision, any number of additional arguments can be passed to the `git checkout` command
208 * by supplying either a string or array of strings as the `what` parameter.
209 */
210 checkout(what: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
211
212 checkout(what: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
213
214 checkout(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
215
216 /**
217 * Checkout a remote branch.
218 *
219 * - branchName name of branch.
220 * - startPoint (e.g origin/development).
221 */
222 checkoutBranch(branchName: string, startPoint: string, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
223
224 /**
225 * Internally uses pull and tags to get the list of tags then checks out the latest tag.
226 */
227 checkoutLatestTag(branchName: string, startPoint: string, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
228
229 /**
230 * Checkout a local branch
231 */
232 checkoutLocalBranch(branchName: string, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
233
234 /**
235 * Deletes unwanted content from the local repo - when supplying the first argument as
236 * an array of `CleanOptions`, the array must include one of `CleanOptions.FORCE` or
237 * `CleanOptions.DRY_RUN`.
238 *
239 * eg:
240 *
241 * ```typescript
242 await git.clean(CleanOptions.FORCE);
243 await git.clean(CleanOptions.DRY_RUN + CleanOptions.RECURSIVE);
244 await git.clean(CleanOptions.FORCE, ['./path']);
245 await git.clean(CleanOptions.IGNORED + CleanOptions.FORCE, {'./path': null});
246 * ```
247 */
248 clean(args: types.CleanOptions[], options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.CleanSummary>): Response<resp.CleanSummary>;
249
250 clean(mode: types.CleanMode | string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.CleanSummary>): Response<resp.CleanSummary>;
251
252 clean(mode: types.CleanMode | string, callback?: types.SimpleGitTaskCallback<resp.CleanSummary>): Response<resp.CleanSummary>;
253
254 clean(options?: types.TaskOptions): Response<resp.CleanSummary>;
255
256 clean(callback?: types.SimpleGitTaskCallback<resp.CleanSummary>): Response<resp.CleanSummary>;
257
258 /**
259 * Clears the queue of pending commands and returns the wrapper instance for chaining.
260 */
261 clearQueue(): this;
262
263 /**
264 * Clone a repository into a new directory.
265 *
266 * - repoPath repository url to clone e.g. https://github.com/steveukx/git-js.git
267 * - localPath local folder path to clone to.
268 * - options supported by [git](https://git-scm.com/docs/git-clone).
269 */
270 clone(repoPath: string, localPath: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
271
272 clone(repoPath: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
273
274 /**
275 * Commits changes in the current working directory - when specific file paths are supplied, only changes on those
276 * files will be committed.
277 */
278 commit(
279 message: string | string[],
280 files?: string | string[],
281 options?: types.Options,
282 callback?: types.SimpleGitTaskCallback<resp.CommitResult>): Response<resp.CommitResult>;
283
284 commit(
285 message: string | string[],
286 options?: types.TaskOptions,
287 callback?: types.SimpleGitTaskCallback<resp.CommitResult>): Response<resp.CommitResult>;
288
289 commit(
290 message: string | string[],
291 files?: string | string[],
292 callback?: types.SimpleGitTaskCallback<resp.CommitResult>): Response<resp.CommitResult>;
293
294 commit(
295 message: string | string[],
296 callback?: types.SimpleGitTaskCallback<resp.CommitResult>): Response<resp.CommitResult>;
297
298 /**
299 * Sets the path to a custom git binary, should either be `git` when there is an installation of git available on
300 * the system path, or a fully qualified path to the executable.
301 */
302 customBinary(command: string): this;
303
304 /**
305 * Delete one local branch. Supply the branchName as a string to return a
306 * single `BranchDeletionSummary` instances.
307 *
308 * - branchName name of branch
309 * - forceDelete (optional, defaults to false) set to true to forcibly delete unmerged branches
310 */
311 deleteLocalBranch(branchName: string, forceDelete?: boolean, callback?: types.SimpleGitTaskCallback<resp.BranchSingleDeleteResult>): Response<resp.BranchSingleDeleteResult>;
312
313 deleteLocalBranch(branchName: string, callback?: types.SimpleGitTaskCallback<resp.BranchSingleDeleteResult>): Response<resp.BranchSingleDeleteResult>;
314
315 /**
316 * Delete one or more local branches. Supply the branchName as a string to return a
317 * single `BranchDeletionSummary` or as an array of branch names to return an array of
318 * `BranchDeletionSummary` instances.
319 *
320 * - branchNames name of branch or array of branch names
321 * - forceDelete (optional, defaults to false) set to true to forcibly delete unmerged branches
322 */
323 deleteLocalBranches(branchNames: string[], forceDelete?: boolean, callback?: types.SimpleGitTaskCallback<resp.BranchMultiDeleteResult>): Response<resp.BranchMultiDeleteResult>;
324
325 /**
326 * Get the diff of the current repo compared to the last commit with a set of options supplied as a string.
327 */
328 diff(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
329
330 /**
331 * Gets a summary of the diff for files in the repo, uses the `git diff --stat` format to calculate changes.
332 *
333 * in order to get staged (only): `--cached` or `--staged`.
334 */
335 diffSummary(command: string | number, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.DiffResult>): Response<resp.DiffResult>;
336
337 diffSummary(command: string | number, callback?: types.SimpleGitTaskCallback<resp.DiffResult>): Response<resp.DiffResult>;
338
339 diffSummary(options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.DiffResult>): Response<resp.DiffResult>;
340
341 diffSummary(callback?: types.SimpleGitTaskCallback<resp.DiffResult>): Response<resp.DiffResult>;
342
343 /**
344 * Sets an environment variable for the spawned child process, either supply both a name and value as strings or
345 * a single object to entirely replace the current environment variables.
346 *
347 * @param {string|Object} name
348 * @param {string} [value]
349 */
350 env(name: string, value: string): this;
351
352 env(env: object): this;
353
354 /**
355 * Calls the supplied `handle` function at the next step in the chain, used to run arbitrary functions synchronously
356 * before the next task in the git api.
357 */
358 exec(handle: () => void): Response<void>;
359
360 /**
361 * Updates the local working copy database with changes from the default remote repo and branch.
362 */
363 fetch(remote: string, branch: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
364
365 fetch(remote: string, branch: string, callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
366
367 fetch(remote: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
368
369 fetch(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
370
371 fetch(callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
372
373 /**
374 * Gets the current value of a configuration property by it key, optionally specify the scope in which
375 * to run the command (omit / set to `undefined` to check in the complete overlaid configuration visible
376 * to the `git` process).
377 */
378 getConfig(key: string, scope?: keyof typeof types.GitConfigScope, callback?: types.SimpleGitTaskCallback<string>): Response<resp.ConfigGetResult>;
379
380 /**
381 * Gets the currently available remotes, setting the optional verbose argument to true includes additional
382 * detail on the remotes themselves.
383 */
384 getRemotes(callback?: types.SimpleGitTaskCallback<types.RemoteWithoutRefs[]>): Response<types.RemoteWithoutRefs[]>;
385
386 getRemotes(verbose?: false, callback?: types.SimpleGitTaskCallback<types.RemoteWithoutRefs[]>): Response<types.RemoteWithoutRefs[]>;
387
388 getRemotes(verbose: true, callback?: types.SimpleGitTaskCallback<types.RemoteWithRefs[]>): Response<types.RemoteWithRefs[]>;
389
390 /**
391 * List remotes by running the `ls-remote` command with any number of arbitrary options
392 * in either array of object form.
393 */
394 listRemote(args?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
395
396 /**
397 * Show commit logs from `HEAD` to the first commit.
398 * If provided between `options.from` and `options.to` tags or branch.
399 *
400 * You can provide `options.file`, which is the path to a file in your repository. Then only this file will be considered.
401 *
402 * To use a custom splitter in the log format, set `options.splitter` to be the string the log should be split on.
403 *
404 * By default the following fields will be part of the result:
405 * `hash`: full commit hash
406 * `date`: author date, ISO 8601-like format
407 * `message`: subject + ref names, like the --decorate option of git-log
408 * `author_name`: author name
409 * `author_email`: author mail
410 * You can specify `options.format` to be an mapping from key to a format option like `%H` (for commit hash).
411 * The fields specified in `options.format` will be the fields in the result.
412 *
413 * Options can also be supplied as a standard options object for adding custom properties supported by the git log command.
414 * For any other set of options, supply options as an array of strings to be appended to the git log command.
415 *
416 * @returns Response<ListLogSummary>
417 *
418 * @see https://git-scm.com/docs/git-log
419 */
420 log<T = types.DefaultLogFields>(options?: types.TaskOptions | types.LogOptions<T>, callback?: types.SimpleGitTaskCallback<resp.LogResult<T>>): Response<resp.LogResult<T>>;
421
422 /**
423 * Mirror a git repo
424 *
425 * Equivalent to `git.clone(repoPath, localPath, ['--mirror'])`, `clone` allows
426 * for additional task options.
427 */
428 mirror(repoPath: string, localPath: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
429
430 /**
431 * Moves one or more files to a new destination.
432 *
433 * @see https://git-scm.com/docs/git-mv
434 */
435 mv(from: string | string[], to: string, callback?: types.SimpleGitTaskCallback<resp.MoveSummary>): Response<resp.MoveSummary>;
436
437 /**
438 * Fetch from and integrate with another repository or a local branch.
439 */
440 pull(remote?: string, branch?: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PullResult>): Response<resp.PullResult>;
441
442 pull(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PullResult>): Response<resp.PullResult>;
443
444 pull(callback?: types.SimpleGitTaskCallback<resp.PullResult>): Response<resp.PullResult>;
445
446 /**
447 * Pushes the current tag changes to a remote which can be either a URL or named remote. When not specified uses the
448 * default configured remote spec.
449 */
450 pushTags(remote: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
451
452 pushTags(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
453
454 pushTags(callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
455
456 /**
457 * Executes any command against the git binary.
458 */
459 raw(commands: string | string[] | types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
460
461 raw(options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
462
463 raw(...commands: string[]): Response<string>;
464
465 // leading varargs with trailing options/callback
466 raw(a: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
467
468 raw(a: string, b: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
469
470 raw(a: string, b: string, c: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
471
472 raw(a: string, b: string, c: string, d: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
473
474 raw(a: string, b: string, c: string, d: string, e: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
475
476 // leading varargs with trailing callback
477 raw(a: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
478
479 raw(a: string, b: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
480
481 raw(a: string, b: string, c: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
482
483 raw(a: string, b: string, c: string, d: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
484
485 raw(a: string, b: string, c: string, d: string, e: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
486
487 /**
488 * Rebases the current working copy. Options can be supplied either as an array of string parameters
489 * to be sent to the `git rebase` command, or a standard options object.
490 */
491 rebase(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
492
493 rebase(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
494
495 /**
496 * Call any `git remote` function with arguments passed as an array of strings.
497 */
498 remote(options: string[], callback?: types.SimpleGitTaskCallback<void | string>): Response<void | string>;
499
500 /**
501 * Removes an entry from the list of remotes.
502 *
503 * - remoteName Name of the repository - eg "upstream"
504 */
505 removeRemote(remoteName: string, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
506
507 /**
508 * Reset a repo. Called without arguments this is a soft reset for the whole repo,
509 * for explicitly setting the reset mode, supply the first argument as one of the
510 * supported reset modes.
511 *
512 * Trailing options argument can be either a string array, or an extension of the
513 * ResetOptions, use this argument for supplying arbitrary additional arguments,
514 * such as restricting the pathspec.
515 *
516 * ```typescript
517 // equivalent to each other
518 simpleGit().reset(ResetMode.HARD, ['--', 'my-file.txt']);
519 simpleGit().reset(['--hard', '--', 'my-file.txt']);
520 simpleGit().reset(ResetMode.HARD, {'--': null, 'my-file.txt': null});
521 simpleGit().reset({'--hard': null, '--': null, 'my-file.txt': null});
522 ```
523 */
524 reset(mode: types.ResetMode, options?: types.TaskOptions<types.ResetOptions>, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
525
526 reset(mode: types.ResetMode, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
527
528 reset(options?: types.TaskOptions<types.ResetOptions>, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
529
530 /**
531 * Revert one or more commits in the local working copy
532 *
533 * - commit The commit to revert. Can be any hash, offset (eg: `HEAD~2`) or range (eg: `master~5..master~2`)
534 */
535 revert(commit: String, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
536
537 revert(commit: String, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
538
539 /**
540 * Passes the supplied options to `git rev-parse` and returns the string response. Options can be either a
541 * string array or `Options` object of options compatible with the [rev-parse](https://git-scm.com/docs/git-rev-parse)
542 *
543 * Example uses of `rev-parse` include converting friendly commit references (ie: branch names) to SHA1 hashes
544 * and retrieving meta details about the current repo (eg: the root directory, and whether it was created as
545 * a bare repo).
546 */
547 revparse(option: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
548
549 revparse(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
550
551 /**
552 * Removes the named files from source control.
553 */
554 rm(paths: string | string[], callback?: types.SimpleGitTaskCallback<void>): Response<void>;
555
556 /**
557 * Removes the named files from source control but keeps them on disk rather than deleting them entirely. To
558 * completely remove the files, use `rm`.
559 */
560 rmKeepLocal(paths: string | string[], callback?: types.SimpleGitTaskCallback<void>): Response<void>;
561
562 /**
563 * Show various types of objects, for example the file at a certain commit
564 */
565 show(option: string | types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
566
567 show(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
568
569 /**
570 * @deprecated
571 *
572 * From version 2.7.0, use of `silent` is deprecated in favour of using the `debug` library, this method will
573 * be removed in version 3.x.
574 *
575 * Please see the [readme](https://github.com/steveukx/git-js/blob/master/readme.md#enable-logging) for more details.
576 *
577 * Disables/enables the use of the console for printing warnings and errors, by default messages are not shown in
578 * a production environment.
579 *
580 * @param {boolean} silence
581 */
582 silent(silence?: boolean): this;
583
584 /**
585 * List the stash(s) of the local repo
586 */
587 stashList(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.LogResult>): Response<resp.LogResult>;
588
589 stashList(callback?: types.SimpleGitTaskCallback<resp.LogResult>): Response<resp.LogResult>;
590
591 /**
592 * Call any `git submodule` function with arguments passed as an array of strings.
593 */
594 subModule(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
595
596 /**
597 * Add a submodule
598 */
599 submoduleAdd(repo: string, path: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
600
601 /**
602 * Initialise submodules
603 */
604 submoduleInit(moduleName: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
605
606 submoduleInit(moduleName: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
607
608 submoduleInit(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
609
610 submoduleInit(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
611
612 /**
613 * Update submodules
614 */
615 submoduleUpdate(moduleName: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
616
617 submoduleUpdate(moduleName: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
618
619 submoduleUpdate(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
620
621 submoduleUpdate(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
622
623 /**
624 * List all tags. When using git 2.7.0 or above, include an options object with `"--sort": "property-name"` to
625 * sort the tags by that property instead of using the default semantic versioning sort.
626 *
627 * Note, supplying this option when it is not supported by your Git version will cause the operation to fail.
628 */
629 tag(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
630
631 /**
632 * Gets a list of tagged versions.
633 */
634 tags(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.TagResult>): Response<resp.TagResult>;
635
636 tags(callback?: types.SimpleGitTaskCallback<resp.TagResult>): Response<resp.TagResult>;
637
638 /**
639 * Updates repository server info
640 */
641 updateServerInfo(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
642}