Socket
Socket
Sign inDemoInstall

simple-git

Package Overview
Dependencies
Maintainers
2
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-git - npm Package Compare versions

Comparing version 3.10.0 to 3.11.0

2

dist/src/lib/plugins/completion-detection.plugin.d.ts
import { SimpleGitPluginConfig } from '../types';
import { SimpleGitPlugin } from './simple-git-plugin';
export declare function completionDetectionPlugin({ onClose, onExit }?: SimpleGitPluginConfig['completion']): SimpleGitPlugin<'spawn.after'>;
export declare function completionDetectionPlugin({ onClose, onExit, }?: SimpleGitPluginConfig['completion']): SimpleGitPlugin<'spawn.after'>;
import { SimpleGitOptions } from '../types';
import { SimpleGitPlugin } from './simple-git-plugin';
export declare function timeoutPlugin({ block }: Exclude<SimpleGitOptions['timeout'], undefined>): SimpleGitPlugin<'spawn.after'> | void;
export declare function timeoutPlugin({ block, }: Exclude<SimpleGitOptions['timeout'], undefined>): SimpleGitPlugin<'spawn.after'> | void;

@@ -5,3 +5,3 @@ export declare class LineParser<T> {

constructor(regExp: RegExp | RegExp[], useMatches?: (target: T, match: string[]) => boolean | void);
parse: (line: (offset: number) => (string | undefined), target: T) => boolean;
parse: (line: (offset: number) => string | undefined, target: T) => boolean;
protected useMatches(target: T, match: string[]): boolean | void;

@@ -8,0 +8,0 @@ protected resetMatches(): void;

@@ -1,2 +0,1 @@

export * from '../src/lib/errors/git-error';

@@ -3,0 +2,0 @@ export * from '../src/lib/errors/git-construct-error';

@@ -113,3 +113,2 @@ import { DefaultLogFields } from '../src/lib/tasks/log';

export interface ConfigListSummary {
/**

@@ -180,2 +179,11 @@ * All configuration settings, where local/user settings override user/global settings

}[];
updated: {
name: string;
tracking: string;
to: string;
from: string;
}[];
deleted: {
tracking: string;
}[];
}

@@ -186,7 +194,10 @@

paths: Set<string>;
results: Record<string, Array<{
line: number;
path: string;
preview: string;
}>>;
results: Record<
string,
Array<{
line: number;
path: string;
preview: string;
}>
>;
}

@@ -228,3 +239,3 @@

*/
moves: Array<{ from: string, to: string }>;
moves: Array<{ from: string; to: string }>;
}

@@ -261,4 +272,3 @@

export interface PullResult extends PullDetail, RemoteMessageResult {
}
export interface PullResult extends PullDetail, RemoteMessageResult {}

@@ -270,11 +280,11 @@ /**

export interface PullFailedResult {
remote: string,
remote: string;
hash: {
local: string;
remote: string;
},
};
branch: {
local: string;
remote: string;
},
};
message: string;

@@ -292,5 +302,4 @@ }

export interface FileStatusResult {
/** Original location of the file, when the file has been moved */
from?: string
from?: string;

@@ -416,3 +425,2 @@ /** Path of the file */

export interface MergeConflict {
/**

@@ -460,14 +468,14 @@ * Type of conflict

export interface RemoteMessagesObjectEnumeration {
enumerating: number,
counting: number,
compressing: number,
enumerating: number;
counting: number;
compressing: number;
total: {
count: number,
delta: number,
},
count: number;
delta: number;
};
reused: {
count: number,
delta: number,
},
packReused: number,
count: number;
delta: number;
};
packReused: number;
}

@@ -518,4 +526,3 @@

export interface PushResult extends PushDetail, RemoteMessageResult<PushResultRemoteMessages> {
}
export interface PushResult extends PushDetail, RemoteMessageResult<PushResultRemoteMessages> {}

@@ -522,0 +529,0 @@ /**

@@ -24,5 +24,11 @@ import * as resp from './response';

*/
cwd(directory: { path: string, root?: boolean }, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
cwd(
directory: { path: string; root?: boolean },
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
cwd<path extends string>(directory: path, callback?: types.SimpleGitTaskCallback<path>): Response<path>;
cwd<path extends string>(
directory: path,
callback?: types.SimpleGitTaskCallback<path>
): Response<path>;

@@ -34,3 +40,7 @@ /**

hashObject(path: string, write ?: boolean, callback?: types.SimpleGitTaskCallback): Response<string>;
hashObject(
path: string,
write?: boolean,
callback?: types.SimpleGitTaskCallback
): Response<string>;

@@ -40,7 +50,17 @@ /**

*/
init(bare: boolean, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.InitResult>): Response<resp.InitResult>;
init(
bare: boolean,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.InitResult>
): Response<resp.InitResult>;
init(bare: boolean, callback?: types.SimpleGitTaskCallback<resp.InitResult>): Response<resp.InitResult>;
init(
bare: boolean,
callback?: types.SimpleGitTaskCallback<resp.InitResult>
): Response<resp.InitResult>;
init(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.InitResult>): Response<resp.InitResult>;
init(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.InitResult>
): Response<resp.InitResult>;

@@ -61,3 +81,6 @@ init(callback?: types.SimpleGitTaskCallback<resp.InitResult>): Response<resp.InitResult>;

*/
merge(options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.MergeResult>): Response<resp.MergeResult>;
merge(
options: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.MergeResult>
): Response<resp.MergeResult>;

@@ -68,5 +91,14 @@ /**

*/
mergeFromTo<E extends GitError>(remote: string, branch: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.MergeResult, E>): Response<resp.MergeResult>;
mergeFromTo<E extends GitError>(
remote: string,
branch: string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.MergeResult, E>
): Response<resp.MergeResult>;
mergeFromTo<E extends GitError>(remote: string, branch: string, callback?: types.SimpleGitTaskCallback<resp.MergeResult, E>): Response<resp.MergeResult>;
mergeFromTo<E extends GitError>(
remote: string,
branch: string,
callback?: types.SimpleGitTaskCallback<resp.MergeResult, E>
): Response<resp.MergeResult>;

@@ -93,5 +125,13 @@ /**

*/
push(remote?: string, branch?: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
push(
remote?: string,
branch?: string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.PushResult>
): Response<resp.PushResult>;
push(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
push(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.PushResult>
): Response<resp.PushResult>;

@@ -103,3 +143,6 @@ push(callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;

*/
stash(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
stash(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -111,14 +154,19 @@ stash(callback?: types.SimpleGitTaskCallback<string>): Response<string>;

*/
status(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.StatusResult>): Response<resp.StatusResult>;
status(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.StatusResult>
): Response<resp.StatusResult>;
status(callback?: types.SimpleGitTaskCallback<resp.StatusResult>): Response<resp.StatusResult>;
}
export interface SimpleGit extends SimpleGitBase {
/**
* Add an annotated tag to the head of the current branch
*/
addAnnotatedTag(tagName: string, tagMessage: string, callback?: types.SimpleGitTaskCallback<{ name: string }>): Response<{ name: string }>;
addAnnotatedTag(
tagName: string,
tagMessage: string,
callback?: types.SimpleGitTaskCallback<{ name: string }>
): Response<{ name: string }>;

@@ -129,7 +177,22 @@ /**

*/
addConfig(key: string, value: string, append?: boolean, scope?: keyof typeof types.GitConfigScope, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
addConfig(
key: string,
value: string,
append?: boolean,
scope?: keyof typeof types.GitConfigScope,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
addConfig(key: string, value: string, append?: boolean, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
addConfig(
key: string,
value: string,
append?: boolean,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
addConfig(key: string, value: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
addConfig(
key: string,
value: string,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -139,5 +202,12 @@ /**

*/
applyPatch(patches: string | string[], options: types.TaskOptions<types.ApplyOptions>, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
applyPatch(
patches: string | string[],
options: types.TaskOptions<types.ApplyOptions>,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
applyPatch(patches: string | string[], callback?: types.SimpleGitTaskCallback<string>): Response<string>;
applyPatch(
patches: string | string[],
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -147,5 +217,10 @@ /**

*/
listConfig(scope: keyof typeof types.GitConfigScope, callback?: types.SimpleGitTaskCallback<resp.ConfigListSummary>): Response<resp.ConfigListSummary>;
listConfig(
scope: keyof typeof types.GitConfigScope,
callback?: types.SimpleGitTaskCallback<resp.ConfigListSummary>
): Response<resp.ConfigListSummary>;
listConfig(callback?: types.SimpleGitTaskCallback<resp.ConfigListSummary>): Response<resp.ConfigListSummary>;
listConfig(
callback?: types.SimpleGitTaskCallback<resp.ConfigListSummary>
): Response<resp.ConfigListSummary>;

@@ -159,5 +234,14 @@ /**

*/
addRemote(remoteName: string, remoteRepo: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
addRemote(
remoteName: string,
remoteRepo: string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
addRemote(remoteName: string, remoteRepo: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
addRemote(
remoteName: string,
remoteRepo: string,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -167,3 +251,6 @@ /**

*/
addTag(name: string, callback?: types.SimpleGitTaskCallback<{ name: string }>): Response<{ name: string }>;
addTag(
name: string,
callback?: types.SimpleGitTaskCallback<{ name: string }>
): Response<{ name: string }>;

@@ -178,3 +265,6 @@ /**

*/
branch(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.BranchSummary>): Response<resp.BranchSummary>;
branch(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.BranchSummary>
): Response<resp.BranchSummary>;

@@ -184,3 +274,5 @@ /**

*/
branchLocal(callback?: types.SimpleGitTaskCallback<resp.BranchSummary>): Response<resp.BranchSummary>;
branchLocal(
callback?: types.SimpleGitTaskCallback<resp.BranchSummary>
): Response<resp.BranchSummary>;

@@ -203,3 +295,6 @@ /**

*/
checkIgnore(pathNames: string[], callback?: types.SimpleGitTaskCallback<string[]>): Response<string[]>;
checkIgnore(
pathNames: string[],
callback?: types.SimpleGitTaskCallback<string[]>
): Response<string[]>;

@@ -218,3 +313,6 @@ checkIgnore(path: string, callback?: types.SimpleGitTaskCallback<string[]>): Response<string[]>;

*/
checkIsRepo(action?: types.CheckRepoActions, callback?: types.SimpleGitTaskCallback<boolean>): Response<boolean>;
checkIsRepo(
action?: types.CheckRepoActions,
callback?: types.SimpleGitTaskCallback<boolean>
): Response<boolean>;

@@ -227,7 +325,14 @@ checkIsRepo(callback?: types.SimpleGitTaskCallback<boolean>): Response<boolean>;

*/
checkout(what: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
checkout(
what: string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
checkout(what: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
checkout(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
checkout(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -240,3 +345,7 @@ /**

*/
checkoutBranch(branchName: string, startPoint: string, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
checkoutBranch(
branchName: string,
startPoint: string,
callback?: types.SimpleGitTaskCallback<void>
): Response<void>;

@@ -246,3 +355,7 @@ /**

*/
checkoutLatestTag(branchName: string, startPoint: string, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
checkoutLatestTag(
branchName: string,
startPoint: string,
callback?: types.SimpleGitTaskCallback<void>
): Response<void>;

@@ -252,3 +365,6 @@ /**

*/
checkoutLocalBranch(branchName: string, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
checkoutLocalBranch(
branchName: string,
callback?: types.SimpleGitTaskCallback<void>
): Response<void>;

@@ -269,7 +385,18 @@ /**

*/
clean(args: types.CleanOptions[], options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.CleanSummary>): Response<resp.CleanSummary>;
clean(
args: types.CleanOptions[],
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.CleanSummary>
): Response<resp.CleanSummary>;
clean(mode: types.CleanMode | string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.CleanSummary>): Response<resp.CleanSummary>;
clean(
mode: types.CleanMode | string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.CleanSummary>
): Response<resp.CleanSummary>;
clean(mode: types.CleanMode | string, callback?: types.SimpleGitTaskCallback<resp.CleanSummary>): Response<resp.CleanSummary>;
clean(
mode: types.CleanMode | string,
callback?: types.SimpleGitTaskCallback<resp.CleanSummary>
): Response<resp.CleanSummary>;

@@ -292,5 +419,14 @@ clean(options?: types.TaskOptions): Response<resp.CleanSummary>;

*/
clone(repoPath: string, localPath: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
clone(
repoPath: string,
localPath: string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
clone(repoPath: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
clone(
repoPath: string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -305,3 +441,4 @@ /**

options?: types.Options,
callback?: types.SimpleGitTaskCallback<resp.CommitResult>): Response<resp.CommitResult>;
callback?: types.SimpleGitTaskCallback<resp.CommitResult>
): Response<resp.CommitResult>;

@@ -311,3 +448,4 @@ commit(

options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.CommitResult>): Response<resp.CommitResult>;
callback?: types.SimpleGitTaskCallback<resp.CommitResult>
): Response<resp.CommitResult>;

@@ -317,7 +455,9 @@ commit(

files?: string | string[],
callback?: types.SimpleGitTaskCallback<resp.CommitResult>): Response<resp.CommitResult>;
callback?: types.SimpleGitTaskCallback<resp.CommitResult>
): Response<resp.CommitResult>;
commit(
message: string | string[],
callback?: types.SimpleGitTaskCallback<resp.CommitResult>): Response<resp.CommitResult>;
callback?: types.SimpleGitTaskCallback<resp.CommitResult>
): Response<resp.CommitResult>;

@@ -337,5 +477,12 @@ /**

*/
deleteLocalBranch(branchName: string, forceDelete?: boolean, callback?: types.SimpleGitTaskCallback<resp.BranchSingleDeleteResult>): Response<resp.BranchSingleDeleteResult>;
deleteLocalBranch(
branchName: string,
forceDelete?: boolean,
callback?: types.SimpleGitTaskCallback<resp.BranchSingleDeleteResult>
): Response<resp.BranchSingleDeleteResult>;
deleteLocalBranch(branchName: string, callback?: types.SimpleGitTaskCallback<resp.BranchSingleDeleteResult>): Response<resp.BranchSingleDeleteResult>;
deleteLocalBranch(
branchName: string,
callback?: types.SimpleGitTaskCallback<resp.BranchSingleDeleteResult>
): Response<resp.BranchSingleDeleteResult>;

@@ -350,3 +497,7 @@ /**

*/
deleteLocalBranches(branchNames: string[], forceDelete?: boolean, callback?: types.SimpleGitTaskCallback<resp.BranchMultiDeleteResult>): Response<resp.BranchMultiDeleteResult>;
deleteLocalBranches(
branchNames: string[],
forceDelete?: boolean,
callback?: types.SimpleGitTaskCallback<resp.BranchMultiDeleteResult>
): Response<resp.BranchMultiDeleteResult>;

@@ -356,3 +507,6 @@ /**

*/
diff(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
diff(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -364,7 +518,17 @@ /**

*/
diffSummary(command: string | number, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.DiffResult>): Response<resp.DiffResult>;
diffSummary(
command: string | number,
options: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.DiffResult>
): Response<resp.DiffResult>;
diffSummary(command: string | number, callback?: types.SimpleGitTaskCallback<resp.DiffResult>): Response<resp.DiffResult>;
diffSummary(
command: string | number,
callback?: types.SimpleGitTaskCallback<resp.DiffResult>
): Response<resp.DiffResult>;
diffSummary(options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.DiffResult>): Response<resp.DiffResult>;
diffSummary(
options: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.DiffResult>
): Response<resp.DiffResult>;

@@ -393,9 +557,25 @@ diffSummary(callback?: types.SimpleGitTaskCallback<resp.DiffResult>): Response<resp.DiffResult>;

*/
fetch(remote: string, branch: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
fetch(
remote: string,
branch: string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.FetchResult>
): Response<resp.FetchResult>;
fetch(remote: string, branch: string, callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
fetch(
remote: string,
branch: string,
callback?: types.SimpleGitTaskCallback<resp.FetchResult>
): Response<resp.FetchResult>;
fetch(remote: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
fetch(
remote: string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.FetchResult>
): Response<resp.FetchResult>;
fetch(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
fetch(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.FetchResult>
): Response<resp.FetchResult>;

@@ -409,3 +589,7 @@ fetch(callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;

*/
getConfig(key: string, scope?: keyof typeof types.GitConfigScope, callback?: types.SimpleGitTaskCallback<string>): Response<resp.ConfigGetResult>;
getConfig(
key: string,
scope?: keyof typeof types.GitConfigScope,
callback?: types.SimpleGitTaskCallback<string>
): Response<resp.ConfigGetResult>;

@@ -416,7 +600,15 @@ /**

*/
getRemotes(callback?: types.SimpleGitTaskCallback<types.RemoteWithoutRefs[]>): Response<types.RemoteWithoutRefs[]>;
getRemotes(
callback?: types.SimpleGitTaskCallback<types.RemoteWithoutRefs[]>
): Response<types.RemoteWithoutRefs[]>;
getRemotes(verbose?: false, callback?: types.SimpleGitTaskCallback<types.RemoteWithoutRefs[]>): Response<types.RemoteWithoutRefs[]>;
getRemotes(
verbose?: false,
callback?: types.SimpleGitTaskCallback<types.RemoteWithoutRefs[]>
): Response<types.RemoteWithoutRefs[]>;
getRemotes(verbose: true, callback?: types.SimpleGitTaskCallback<types.RemoteWithRefs[]>): Response<types.RemoteWithRefs[]>;
getRemotes(
verbose: true,
callback?: types.SimpleGitTaskCallback<types.RemoteWithRefs[]>
): Response<types.RemoteWithRefs[]>;

@@ -426,5 +618,12 @@ /**

*/
grep(searchTerm: string | types.GitGrepQuery, callback?: types.SimpleGitTaskCallback<resp.GrepResult>): Response<resp.GrepResult>;
grep(
searchTerm: string | types.GitGrepQuery,
callback?: types.SimpleGitTaskCallback<resp.GrepResult>
): Response<resp.GrepResult>;
grep(searchTerm: string | types.GitGrepQuery, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.GrepResult>): Response<resp.GrepResult>;
grep(
searchTerm: string | types.GitGrepQuery,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.GrepResult>
): Response<resp.GrepResult>;

@@ -435,3 +634,6 @@ /**

*/
listRemote(args?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
listRemote(
args?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -462,3 +664,6 @@ /**

*/
log<T = types.DefaultLogFields>(options?: types.TaskOptions | types.LogOptions<T>, callback?: types.SimpleGitTaskCallback<resp.LogResult<T>>): Response<resp.LogResult<T>>;
log<T = types.DefaultLogFields>(
options?: types.TaskOptions | types.LogOptions<T>,
callback?: types.SimpleGitTaskCallback<resp.LogResult<T>>
): Response<resp.LogResult<T>>;

@@ -471,3 +676,7 @@ /**

*/
mirror(repoPath: string, localPath: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
mirror(
repoPath: string,
localPath: string,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -479,3 +688,7 @@ /**

*/
mv(from: string | string[], to: string, callback?: types.SimpleGitTaskCallback<resp.MoveSummary>): Response<resp.MoveSummary>;
mv(
from: string | string[],
to: string,
callback?: types.SimpleGitTaskCallback<resp.MoveSummary>
): Response<resp.MoveSummary>;

@@ -486,5 +699,13 @@ /**

*/
pull(remote?: string, branch?: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PullResult>): Response<resp.PullResult>;
pull(
remote?: string,
branch?: string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.PullResult>
): Response<resp.PullResult>;
pull(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PullResult>): Response<resp.PullResult>;
pull(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.PullResult>
): Response<resp.PullResult>;

@@ -497,5 +718,12 @@ pull(callback?: types.SimpleGitTaskCallback<resp.PullResult>): Response<resp.PullResult>;

*/
pushTags(remote: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
pushTags(
remote: string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.PushResult>
): Response<resp.PushResult>;
pushTags(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
pushTags(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.PushResult>
): Response<resp.PushResult>;

@@ -507,5 +735,11 @@ pushTags(callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;

*/
raw(commands: string | string[] | types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(
commands: string | string[] | types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
raw(options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(
options: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -515,11 +749,41 @@ raw(...commands: string[]): Response<string>;

// leading varargs with trailing options/callback
raw(a: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(
a: string,
options: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
raw(a: string, b: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(
a: string,
b: string,
options: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
raw(a: string, b: string, c: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(
a: string,
b: string,
c: string,
options: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
raw(a: string, b: string, c: string, d: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(
a: string,
b: string,
c: string,
d: string,
options: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
raw(a: string, b: string, c: string, d: string, e: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(
a: string,
b: string,
c: string,
d: string,
e: string,
options: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -531,7 +795,25 @@ // leading varargs with trailing callback

raw(a: string, b: string, c: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(
a: string,
b: string,
c: string,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
raw(a: string, b: string, c: string, d: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(
a: string,
b: string,
c: string,
d: string,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
raw(a: string, b: string, c: string, d: string, e: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(
a: string,
b: string,
c: string,
d: string,
e: string,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -542,3 +824,6 @@ /**

*/
rebase(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
rebase(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -550,3 +835,6 @@ rebase(callback?: types.SimpleGitTaskCallback<string>): Response<string>;

*/
remote(options: string[], callback?: types.SimpleGitTaskCallback<void | string>): Response<void | string>;
remote(
options: string[],
callback?: types.SimpleGitTaskCallback<void | string>
): Response<void | string>;

@@ -577,7 +865,14 @@ /**

*/
reset(mode: types.ResetMode, options?: types.TaskOptions<types.ResetOptions>, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
reset(
mode: types.ResetMode,
options?: types.TaskOptions<types.ResetOptions>,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
reset(mode: types.ResetMode, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
reset(options?: types.TaskOptions<types.ResetOptions>, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
reset(
options?: types.TaskOptions<types.ResetOptions>,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -589,3 +884,7 @@ /**

*/
revert(commit: String, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
revert(
commit: String,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<void>
): Response<void>;

@@ -602,5 +901,12 @@ revert(commit: String, callback?: types.SimpleGitTaskCallback<void>): Response<void>;

*/
revparse(option: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
revparse(
option: string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
revparse(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
revparse(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -616,3 +922,6 @@ /**

*/
rmKeepLocal(paths: string | string[], callback?: types.SimpleGitTaskCallback<void>): Response<void>;
rmKeepLocal(
paths: string | string[],
callback?: types.SimpleGitTaskCallback<void>
): Response<void>;

@@ -622,3 +931,6 @@ /**

*/
show(option: string | types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
show(
option: string | types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -645,3 +957,6 @@ show(callback?: types.SimpleGitTaskCallback<string>): Response<string>;

*/
stashList(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.LogResult>): Response<resp.LogResult>;
stashList(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.LogResult>
): Response<resp.LogResult>;

@@ -653,3 +968,6 @@ stashList(callback?: types.SimpleGitTaskCallback<resp.LogResult>): Response<resp.LogResult>;

*/
subModule(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
subModule(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -659,3 +977,7 @@ /**

*/
submoduleAdd(repo: string, path: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
submoduleAdd(
repo: string,
path: string,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -665,7 +987,17 @@ /**

*/
submoduleInit(moduleName: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
submoduleInit(
moduleName: string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
submoduleInit(moduleName: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
submoduleInit(
moduleName: string,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
submoduleInit(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
submoduleInit(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -677,7 +1009,17 @@ submoduleInit(callback?: types.SimpleGitTaskCallback<string>): Response<string>;

*/
submoduleUpdate(moduleName: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
submoduleUpdate(
moduleName: string,
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
submoduleUpdate(moduleName: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
submoduleUpdate(
moduleName: string,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;
submoduleUpdate(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
submoduleUpdate(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -692,3 +1034,6 @@ submoduleUpdate(callback?: types.SimpleGitTaskCallback<string>): Response<string>;

*/
tag(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
tag(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<string>
): Response<string>;

@@ -698,3 +1043,6 @@ /**

*/
tags(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.TagResult>): Response<resp.TagResult>;
tags(
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.TagResult>
): Response<resp.TagResult>;

@@ -701,0 +1049,0 @@ tags(callback?: types.SimpleGitTaskCallback<resp.TagResult>): Response<resp.TagResult>;

@@ -5,3 +5,8 @@ export { RemoteWithoutRefs, RemoteWithRefs } from '../src/lib/responses/GetRemoteSummary';

export {
outputHandler, Options, TaskOptions, SimpleGitOptions, SimpleGitProgressEvent, SimpleGitTaskCallback
outputHandler,
Options,
TaskOptions,
SimpleGitOptions,
SimpleGitProgressEvent,
SimpleGitTaskCallback,
} from '../src/lib/types';

@@ -8,0 +13,0 @@

{
"name": "simple-git",
"description": "Simple GIT interface for node.js",
"version": "3.10.0",
"version": "3.11.0",
"author": "Steve King <steve@mydev.co>",

@@ -6,0 +6,0 @@ "contributors": [

@@ -15,5 +15,4 @@ import * as SimpleGitTypes from 'simple-git';

declare namespace simplegit {
type SimpleGitExport = ((basePath?: string) => simplegit.SimpleGit) & {
CleanOptions: typeof SimpleGitTypes.CleanOptions
CleanOptions: typeof SimpleGitTypes.CleanOptions;
};

@@ -39,3 +38,3 @@

// responses
type BranchSummary = SimpleGitTypes.BranchSummary
type BranchSummary = SimpleGitTypes.BranchSummary;
type CleanSummary = SimpleGitTypes.CleanSummary;

@@ -52,3 +51,3 @@ type CleanMode = SimpleGitTypes.CleanMode;

// types
type outputHandler = SimpleGitTypes.outputHandler
type outputHandler = SimpleGitTypes.outputHandler;
type LogOptions<T = SimpleGitTypes.DefaultLogFields> = SimpleGitTypes.LogOptions<T>;

@@ -55,0 +54,0 @@ type Options = SimpleGitTypes.Options;

@@ -13,5 +13,7 @@ // TODO: deprecation warning

module.exports = Object.assign(
function () { return simpleGit.gitP.apply(null, arguments) },
function () {
return simpleGit.gitP.apply(null, arguments);
},
simpleGit,
{ default: simpleGit.gitP },
{ default: simpleGit.gitP }
);
# Simple Git
[![NPM version](https://img.shields.io/npm/v/simple-git.svg)](https://www.npmjs.com/package/simple-git)

@@ -16,4 +17,4 @@

- [npm](https://npmjs.org): `npm install simple-git`
- [yarn](https://yarnpkg.com/): `yarn add simple-git`
- [npm](https://npmjs.org): `npm install simple-git`
- [yarn](https://yarnpkg.com/): `yarn add simple-git`

@@ -34,3 +35,3 @@ # System Dependencies

// or use named properties
const {simpleGit, CleanOptions} = require('simple-git');
const { simpleGit, CleanOptions } = require('simple-git');
simpleGit().clean(CleanOptions.FORCE);

@@ -96,16 +97,16 @@ ```

- [Completion Detection](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-COMPLETION-DETECTION.md)
Customise how `simple-git` detects the end of a `git` process.
- [Completion Detection](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-COMPLETION-DETECTION.md)
Customise how `simple-git` detects the end of a `git` process.
- [Error Detection](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-ERRORS.md)
Customise the detection of errors from the underlying `git` process.
- [Error Detection](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-ERRORS.md)
Customise the detection of errors from the underlying `git` process.
- [Progress Events](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-PROGRESS-EVENTS.md)
Receive progress events as `git` works through long-running processes.
- [Progress Events](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-PROGRESS-EVENTS.md)
Receive progress events as `git` works through long-running processes.
- [Spawned Process Ownership](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-SPAWN-OPTIONS.md)
Configure the system `uid` / `gid` to use for spawned `git` processes.
- [Spawned Process Ownership](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-SPAWN-OPTIONS.md)
Configure the system `uid` / `gid` to use for spawned `git` processes.
- [Timeout](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-TIMEOUT.md)
Automatically kill the wrapped `git` process after a rolling timeout.
- [Timeout](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-TIMEOUT.md)
Automatically kill the wrapped `git` process after a rolling timeout.

@@ -126,4 +127,4 @@ ## Using Task Promises

await git.init();
await git.addRemote('origin', '...remote.git')
```
await git.addRemote('origin', '...remote.git');
```

@@ -135,8 +136,9 @@ ### Catching errors in async code

```javascript
const git = simpleGit()
const git = simpleGit();
try {
await git.init();
await git.addRemote(name, repoUrl);
await git.init();
await git.addRemote(name, repoUrl);
} catch (e) {
/* handle all errors here */
}
catch (e) { /* handle all errors here */ }
```

@@ -148,10 +150,11 @@

```javascript
const git = simpleGit()
const git = simpleGit();
try {
await git.init().catch(ignoreError);
await git.addRemote(name, repoUrl);
await git.init().catch(ignoreError);
await git.addRemote(name, repoUrl);
} catch (e) {
/* handle all errors here */
}
catch (e) { /* handle all errors here */ }
function ignoreError () {}
function ignoreError() {}
```

@@ -168,8 +171,8 @@

function onInit (err, initResult) { }
function onRemoteAdd (err, addRemoteResult) { }
```
function onInit(err, initResult) {}
function onRemoteAdd(err, addRemoteResult) {}
```
If any of the steps in the chain result in an error, all pending steps will be cancelled, see the
[parallel tasks]((#concurrent--parallel-requests)) section for more information on how to run tasks in parallel rather than in series .
[parallel tasks](<(#concurrent--parallel-requests)>) section for more information on how to run tasks in parallel rather than in series .

@@ -185,109 +188,108 @@ ## Task Responses

| API | What it does |
|-----|--------------|
| `.add([fileA, ...], handlerFn)` | adds one or more files to be under source control |
| `.addAnnotatedTag(tagName, tagMessage, handlerFn)` | adds an annotated tag to the head of the current branch |
| `.addTag(name, handlerFn)` | adds a lightweight tag to the head of the current branch |
| `.catFile(options[, handlerFn])` | generate `cat-file` detail, `options` should be an array of strings as supported arguments to the [cat-file](https://git-scm.com/docs/git-cat-file) command |
| `.checkIgnore([filepath, ...], handlerFn)` | checks if filepath excluded by .gitignore rules |
| `.clearQueue()` | immediately clears the queue of pending tasks (note: any command currently in progress will still call its completion callback) |
| `.commit(message, handlerFn)` | commits changes in the current working directory with the supplied message where the message can be either a single string or array of strings to be passed as separate arguments (the `git` command line interface converts these to be separated by double line breaks) |
| API | What it does |
| ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `.add([fileA, ...], handlerFn)` | adds one or more files to be under source control |
| `.addAnnotatedTag(tagName, tagMessage, handlerFn)` | adds an annotated tag to the head of the current branch |
| `.addTag(name, handlerFn)` | adds a lightweight tag to the head of the current branch |
| `.catFile(options[, handlerFn])` | generate `cat-file` detail, `options` should be an array of strings as supported arguments to the [cat-file](https://git-scm.com/docs/git-cat-file) command |
| `.checkIgnore([filepath, ...], handlerFn)` | checks if filepath excluded by .gitignore rules |
| `.clearQueue()` | immediately clears the queue of pending tasks (note: any command currently in progress will still call its completion callback) |
| `.commit(message, handlerFn)` | commits changes in the current working directory with the supplied message where the message can be either a single string or array of strings to be passed as separate arguments (the `git` command line interface converts these to be separated by double line breaks) |
| `.commit(message, [fileA, ...], options, handlerFn)` | commits changes on the named files with the supplied message, when supplied, the optional options object can contain any other parameters to pass to the commit command, setting the value of the property to be a string will add `name=value` to the command string, setting any other type of value will result in just the key from the object being passed (ie: just `name`), an example of setting the author is below |
| `.customBinary(gitPath)` | sets the command to use to reference git, allows for using a git binary not available on the path environment variable |
| `.env(name, value)` | Set environment variables to be passed to the spawned child processes, [see usage in detail below](#environment-variables). |
| `.exec(handlerFn)` | calls a simple function in the current step |
| `.fetch([options, ] handlerFn)` | update the local working copy database with changes from the default remote repo and branch, when supplied the options argument can be a standard [options object](#how-to-specify-options) either an array of string commands as supported by the [git fetch](https://git-scm.com/docs/git-fetch). |
| `.fetch(remote, branch, handlerFn)` | update the local working copy database with changes from a remote repo |
| `.fetch(handlerFn)` | update the local working copy database with changes from the default remote repo and branch |
| `.outputHandler(handlerFn)` | attaches a handler that will be called with the name of the command being run and the `stdout` and `stderr` [readable streams](https://nodejs.org/api/stream.html#stream_class_stream_readable) created by the [child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess) running that command |
| `.raw(args[, handlerFn])` | Execute any arbitrary array of commands supported by the underlying git binary. When the git process returns a non-zero signal on exit and it printed something to `stderr`, the command will be treated as an error, otherwise treated as a success. |
| `.rebase([options,] handlerFn)` | Rebases the repo, `options` should be supplied as an array of string parameters supported by the [git rebase](https://git-scm.com/docs/git-rebase) command, or an object of options (see details below for option formats). |
| `.revert(commit [, options [, handlerFn]])` | reverts one or more commits in the working copy. The commit can be any regular commit-ish value (hash, name or offset such as `HEAD~2`) or a range of commits (eg: `master~5..master~2`). When supplied the [options](#how-to-specify-options) argument contain any options accepted by [git-revert](https://git-scm.com/docs/git-revert). |
| `.rm([fileA, ...], handlerFn)` | removes any number of files from source control |
| `.rmKeepLocal([fileA, ...], handlerFn)` | removes files from source control but leaves them on disk |
| `.tag(args[], handlerFn)` | Runs any supported [git tag](https://git-scm.com/docs/git-tag) commands with arguments passed as an array of strings . |
| `.tags([options, ] handlerFn)` | list all tags, use the optional [options](#how-to-specify-options) object to set any options allows by the [git tag](https://git-scm.com/docs/git-tag) command. Tags will be sorted by semantic version number by default, for git versions 2.7 and above, use the `--sort` option to set a custom sort. |
| `.show([options], handlerFn)` | Show various types of objects, for example the file content at a certain commit. `options` is the single value string or array of string commands you want to run |
| `.customBinary(gitPath)` | sets the command to use to reference git, allows for using a git binary not available on the path environment variable |
| `.env(name, value)` | Set environment variables to be passed to the spawned child processes, [see usage in detail below](#environment-variables). |
| `.exec(handlerFn)` | calls a simple function in the current step |
| `.fetch([options, ] handlerFn)` | update the local working copy database with changes from the default remote repo and branch, when supplied the options argument can be a standard [options object](#how-to-specify-options) either an array of string commands as supported by the [git fetch](https://git-scm.com/docs/git-fetch). |
| `.fetch(remote, branch, handlerFn)` | update the local working copy database with changes from a remote repo |
| `.fetch(handlerFn)` | update the local working copy database with changes from the default remote repo and branch |
| `.outputHandler(handlerFn)` | attaches a handler that will be called with the name of the command being run and the `stdout` and `stderr` [readable streams](https://nodejs.org/api/stream.html#stream_class_stream_readable) created by the [child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess) running that command |
| `.raw(args[, handlerFn])` | Execute any arbitrary array of commands supported by the underlying git binary. When the git process returns a non-zero signal on exit and it printed something to `stderr`, the command will be treated as an error, otherwise treated as a success. |
| `.rebase([options,] handlerFn)` | Rebases the repo, `options` should be supplied as an array of string parameters supported by the [git rebase](https://git-scm.com/docs/git-rebase) command, or an object of options (see details below for option formats). |
| `.revert(commit [, options [, handlerFn]])` | reverts one or more commits in the working copy. The commit can be any regular commit-ish value (hash, name or offset such as `HEAD~2`) or a range of commits (eg: `master~5..master~2`). When supplied the [options](#how-to-specify-options) argument contain any options accepted by [git-revert](https://git-scm.com/docs/git-revert). |
| `.rm([fileA, ...], handlerFn)` | removes any number of files from source control |
| `.rmKeepLocal([fileA, ...], handlerFn)` | removes files from source control but leaves them on disk |
| `.tag(args[], handlerFn)` | Runs any supported [git tag](https://git-scm.com/docs/git-tag) commands with arguments passed as an array of strings . |
| `.tags([options, ] handlerFn)` | list all tags, use the optional [options](#how-to-specify-options) object to set any options allows by the [git tag](https://git-scm.com/docs/git-tag) command. Tags will be sorted by semantic version number by default, for git versions 2.7 and above, use the `--sort` option to set a custom sort. |
| `.show([options], handlerFn)` | Show various types of objects, for example the file content at a certain commit. `options` is the single value string or array of string commands you want to run |
## git apply
- `.applyPatch(patch, [options])` applies a single string patch (as generated by `git diff`), optionally configured with the supplied [options](#how-to-specify-options) to set any arguments supported by the [apply](https://git-scm.com/docs/git-apply) command. Returns the unmodified string response from `stdout` of the `git` binary.
- `.applyPatch(patches, [options])` applies an array of string patches (as generated by `git diff`), optionally configured with the supplied [options](#how-to-specify-options) to set any arguments supported by the [apply](https://git-scm.com/docs/git-apply) command. Returns the unmodified string response from `stdout` of the `git` binary.
- `.applyPatch(patch, [options])` applies a single string patch (as generated by `git diff`), optionally configured with the supplied [options](#how-to-specify-options) to set any arguments supported by the [apply](https://git-scm.com/docs/git-apply) command. Returns the unmodified string response from `stdout` of the `git` binary.
- `.applyPatch(patches, [options])` applies an array of string patches (as generated by `git diff`), optionally configured with the supplied [options](#how-to-specify-options) to set any arguments supported by the [apply](https://git-scm.com/docs/git-apply) command. Returns the unmodified string response from `stdout` of the `git` binary.
## git branch
- `.branch([options])` uses the supplied [options](#how-to-specify-options) to run any arguments supported by the [branch](https://git-scm.com/docs/git-branch) command. Either returns a [BranchSummaryResult](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/BranchSummary.ts) instance when listing branches, or a [BranchSingleDeleteResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts) type object when the options included `-d`, `-D` or `--delete` which cause it to delete a named branch rather than list existing branches.
- `.branchLocal()` gets a list of local branches as a [BranchSummaryResult](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/BranchSummary.ts) instance
- `.deleteLocalBranch(branchName)` deletes a local branch - treats a failed attempt as an error
- `.deleteLocalBranch(branchName, forceDelete)` deletes a local branch, optionally explicitly setting forceDelete to true - treats a failed attempt as an error
- `.deleteLocalBranches(branchNames)` deletes multiple local branches
- `.deleteLocalBranches(branchNames, forceDelete)` deletes multiple local branches, optionally explicitly setting forceDelete to true
- `.branch([options])` uses the supplied [options](#how-to-specify-options) to run any arguments supported by the [branch](https://git-scm.com/docs/git-branch) command. Either returns a [BranchSummaryResult](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/BranchSummary.ts) instance when listing branches, or a [BranchSingleDeleteResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts) type object when the options included `-d`, `-D` or `--delete` which cause it to delete a named branch rather than list existing branches.
- `.branchLocal()` gets a list of local branches as a [BranchSummaryResult](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/BranchSummary.ts) instance
- `.deleteLocalBranch(branchName)` deletes a local branch - treats a failed attempt as an error
- `.deleteLocalBranch(branchName, forceDelete)` deletes a local branch, optionally explicitly setting forceDelete to true - treats a failed attempt as an error
- `.deleteLocalBranches(branchNames)` deletes multiple local branches
- `.deleteLocalBranches(branchNames, forceDelete)` deletes multiple local branches, optionally explicitly setting forceDelete to true
## git clean
- `.clean(mode)` clean the working tree. Mode should be "n" - dry run or "f" - force
- `.clean(cleanSwitches [,options])` set `cleanSwitches` to a string containing any number of the supported single character options, optionally with a standard [options](#how-to-specify-options) object
- `.clean(mode)` clean the working tree. Mode should be "n" - dry run or "f" - force
- `.clean(cleanSwitches [,options])` set `cleanSwitches` to a string containing any number of the supported single character options, optionally with a standard [options](#how-to-specify-options) object
## git checkout
- `.checkout(checkoutWhat [, options])` - checks out the supplied tag, revision or branch when supplied as a string,
- `.checkout(checkoutWhat [, options])` - checks out the supplied tag, revision or branch when supplied as a string,
additional arguments supported by [git checkout](https://git-scm.com/docs/git-checkout) can be supplied as an
[options](#how-to-specify-options) object/array.
- `.checkout(options)` - uses the checks out the supplied [options](#how-to-specify-options) object/array to check out.
- `.checkout(options)` - uses the checks out the supplied [options](#how-to-specify-options) object/array to check out.
- `.checkoutBranch(branchName, startPoint)` - checks out a new branch from the supplied start point.
- `.checkoutBranch(branchName, startPoint)` - checks out a new branch from the supplied start point.
- `.checkoutLocalBranch(branchName)` - checks out a new local branch
- `.checkoutLocalBranch(branchName)` - checks out a new local branch
## git clone
- `.clone(repoPath, [localPath, [options]])` clone a remote repo at `repoPath` to a local directory at `localPath`, optionally with a standard [options](#how-to-specify-options) object of additional arguments to include between `git clone` and the trailing `repo local` arguments
- `.clone(repoPath, [options])` clone a remote repo at `repoPath` to a directory in the current working directory with the same name as the repo
- `.clone(repoPath, [localPath, [options]])` clone a remote repo at `repoPath` to a local directory at `localPath`, optionally with a standard [options](#how-to-specify-options) object of additional arguments to include between `git clone` and the trailing `repo local` arguments
- `.clone(repoPath, [options])` clone a remote repo at `repoPath` to a directory in the current working directory with the same name as the repo
- `mirror(repoPath, [localPath, [options]])` behaves the same as the `.clone` interface with the [`--mirror` flag](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---mirror) enabled.
- `mirror(repoPath, [localPath, [options]])` behaves the same as the `.clone` interface with the [`--mirror` flag](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---mirror) enabled.
## git config
- `.addConfig(key, value, append = false, scope = 'local')` add a local configuration property, when `append` is set to
`true` the configuration setting is appended to rather than overwritten in the local config. Use the `scope` argument
to pick where to save the new configuration setting (use the exported `GitConfigScope` enum, or equivalent string
values - `worktree | local | global | system`).
- `.getConfig(key)` get the value(s) for a named key as a [ConfigGetResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts)
- `.getConfig(key, scope)` get the value(s) for a named key as a [ConfigGetResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts) but limit the
scope of the properties searched to a single specified scope (use the exported `GitConfigScope` enum, or equivalent
string values - `worktree | local | global | system`)
- `.addConfig(key, value, append = false, scope = 'local')` add a local configuration property, when `append` is set to
`true` the configuration setting is appended to rather than overwritten in the local config. Use the `scope` argument
to pick where to save the new configuration setting (use the exported `GitConfigScope` enum, or equivalent string
values - `worktree | local | global | system`).
- `.getConfig(key)` get the value(s) for a named key as a [ConfigGetResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts)
- `.getConfig(key, scope)` get the value(s) for a named key as a [ConfigGetResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts) but limit the
scope of the properties searched to a single specified scope (use the exported `GitConfigScope` enum, or equivalent
string values - `worktree | local | global | system`)
- `.listConfig()` reads the current configuration and returns a [ConfigListSummary](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/ConfigList.ts)
- `.listConfig(scope: GitConfigScope)` as with `listConfig` but returns only those items in a specified scope (note that configuration values are overlaid on top of each other to build the config `git` will actually use - to resolve the configuration you are using use `(await listConfig()).all` without the scope argument)
- `.listConfig()` reads the current configuration and returns a [ConfigListSummary](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/ConfigList.ts)
- `.listConfig(scope: GitConfigScope)` as with `listConfig` but returns only those items in a specified scope (note that configuration values are overlaid on top of each other to build the config `git` will actually use - to resolve the configuration you are using use `(await listConfig()).all` without the scope argument)
## git diff
- `.diff([ options ])` get the diff of the current repo compared to the last commit, optionally including
any number of other arguments supported by [git diff](https://git-scm.com/docs/git-diff) supplied as an
[options](#how-to-specify-options) object/array. Returns the raw `diff` output as a string.
- `.diff([ options ])` get the diff of the current repo compared to the last commit, optionally including
any number of other arguments supported by [git diff](https://git-scm.com/docs/git-diff) supplied as an
[options](#how-to-specify-options) object/array. Returns the raw `diff` output as a string.
- `.diffSummary([ options ])` creates a [DiffResult](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/DiffSummary.ts)
to summarise the diff for files in the repo. Uses the `--stat` format by default which can be overridden
by passing in any of the log format commands (eg: `--numstat` or `--name-stat`) as part of the optional
[options](#how-to-specify-options) object/array.
- `.diffSummary([ options ])` creates a [DiffResult](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/DiffSummary.ts)
to summarise the diff for files in the repo. Uses the `--stat` format by default which can be overridden
by passing in any of the log format commands (eg: `--numstat` or `--name-stat`) as part of the optional
[options](#how-to-specify-options) object/array.
## git grep [examples](https://github.com/steveukx/git-js/blob/main/examples/git-grep.md)
- `.grep(searchTerm)` searches for a single search term across all files in the working tree, optionally passing a standard [options](#how-to-specify-options) object of additional arguments
- `.grep(grepQueryBuilder(...))` use the `grepQueryBuilder` to create a complex query to search for, optionally passing a standard [options](#how-to-specify-options) object of additional arguments
- `.grep(searchTerm)` searches for a single search term across all files in the working tree, optionally passing a standard [options](#how-to-specify-options) object of additional arguments
- `.grep(grepQueryBuilder(...))` use the `grepQueryBuilder` to create a complex query to search for, optionally passing a standard [options](#how-to-specify-options) object of additional arguments
## git hash-object
- `.hashObject(filePath, write = false)` computes the object ID value for the contents of the named file (which can be
outside of the work tree), optionally writing the resulting value to the object database.
- `.hashObject(filePath, write = false)` computes the object ID value for the contents of the named file (which can be
outside of the work tree), optionally writing the resulting value to the object database.
## git init
- `.init(bare [, options])` initialize a repository using the boolean `bare` parameter to intialise a bare repository.
- `.init(bare [, options])` initialize a repository using the boolean `bare` parameter to intialise a bare repository.
Any number of other arguments supported by [git init](https://git-scm.com/docs/git-init) can be supplied as an
[options](#how-to-specify-options) object/array.
- `.init([options])` initialize a repository using any arguments supported by
- `.init([options])` initialize a repository using any arguments supported by
[git init](https://git-scm.com/docs/git-init) supplied as an [options](#how-to-specify-options) object/array.

@@ -297,20 +299,20 @@

- `.log([options])` list commits between `options.from` and `options.to` tags or branch (if not specified will
show all history). Use the `options` object to set any [options](#how-to-specify-options) supported by the
[git log](https://git-scm.com/docs/git-log) command or any of the following:
- `.log([options])` list commits between `options.from` and `options.to` tags or branch (if not specified will
show all history). Use the `options` object to set any [options](#how-to-specify-options) supported by the
[git log](https://git-scm.com/docs/git-log) command or any of the following:
- `options.file` - the path to a file in your repository to only consider this path.
- `options.format` - custom log format object, keys are the property names used on the returned object, values are the format string from [pretty formats](https://git-scm.com/docs/pretty-formats#Documentation/pretty-formats.txt)
- `options.from` - when supplied along with `options.to` sets the range of commits to log
- `options.mailMap` - defaults to true, enables the use of [mail map](https://git-scm.com/docs/gitmailmap) in returned values for email and name from the default format
- `options.maxCount` - equivalent to setting the `--max-count` option
- `options.multiLine` - enables multiline body values in the default format (disabled by default)
- `options.splitter` - the character sequence to use as a delimiter between fields in the log, should be a value that doesn't appear in any log message (defaults to ` ò `)
- `options.strictDate` - switches the authored date value from an ISO 8601-like format to be strict ISO 8601 format
- `options.symmetric` - defaults to true, enables [symmetric revision range](https://git-scm.com/docs/gitrevisions#_dotted_range_notations) rather than a two-dot range
- `options.to` - when supplied along with `options.from` sets the range of commits to log
- `options.file` - the path to a file in your repository to only consider this path.
- `options.format` - custom log format object, keys are the property names used on the returned object, values are the format string from [pretty formats](https://git-scm.com/docs/pretty-formats#Documentation/pretty-formats.txt)
- `options.from` - when supplied along with `options.to` sets the range of commits to log
- `options.mailMap` - defaults to true, enables the use of [mail map](https://git-scm.com/docs/gitmailmap) in returned values for email and name from the default format
- `options.maxCount` - equivalent to setting the `--max-count` option
- `options.multiLine` - enables multiline body values in the default format (disabled by default)
- `options.splitter` - the character sequence to use as a delimiter between fields in the log, should be a value that doesn't appear in any log message (defaults to `ò`)
- `options.strictDate` - switches the authored date value from an ISO 8601-like format to be strict ISO 8601 format
- `options.symmetric` - defaults to true, enables [symmetric revision range](https://git-scm.com/docs/gitrevisions#_dotted_range_notations) rather than a two-dot range
- `options.to` - when supplied along with `options.from` sets the range of commits to log
## git merge
- `.merge(options)` runs a merge using any configuration [options](#how-to-specify-options) supported
- `.merge(options)` runs a merge using any configuration [options](#how-to-specify-options) supported
by [git merge](https://git-scm.com/docs/git-merge).

@@ -324,4 +326,4 @@ Conflicts during the merge result in an error response, the response is an instance of

- `.mergeFromTo(remote, branch [, options])` - merge from the specified branch into the currently checked out branch,
similar to `.merge` but with the `remote` and `branch` supplied as strings separately to any additional
- `.mergeFromTo(remote, branch [, options])` - merge from the specified branch into the currently checked out branch,
similar to `.merge` but with the `remote` and `branch` supplied as strings separately to any additional
[options](#how-to-specify-options).

@@ -331,12 +333,12 @@

- `.mv(from, to)` rename or move a single file at `from` to `to`
- `.mv(from, to)` rename or move a single file at `from` to `to`
- `.mv(from, to)` move all files in the `from` array to the `to` directory
- `.mv(from, to)` move all files in the `from` array to the `to` directory
## git pull
- `.pull([options])` pulls all updates from the default tracked remote, any arguments supported by
- `.pull([options])` pulls all updates from the default tracked remote, any arguments supported by
[git pull](https://git-scm.com/docs/git-pull) can be supplied as an [options](#how-to-specify-options) object/array.
- `.pull(remote, branch[, options])` pulls all updates from the specified remote branch (eg 'origin'/'master') along
- `.pull(remote, branch[, options])` pulls all updates from the specified remote branch (eg 'origin'/'master') along
with any custom [options](#how-to-specify-options) object/array

@@ -346,59 +348,59 @@

- `.push([options])` pushes to a named remote/branch using any supported [options](#how-to-specify-options)
- `.push([options])` pushes to a named remote/branch using any supported [options](#how-to-specify-options)
from the [git push](https://git-scm.com/docs/git-push) command. Note that `simple-git` enforces the use of
`--verbose --porcelain` options in order to parse the response. You don't need to supply these options.
- `.push(remote, branch[, options])` pushes to a named remote/branch, supports additional
- `.push(remote, branch[, options])` pushes to a named remote/branch, supports additional
[options](#how-to-specify-options) from the [git push](https://git-scm.com/docs/git-push) command.
- `.pushTags(remote[, options])` pushes local tags to a named remote (equivalent to using `.push([remote, '--tags'])`)
- `.pushTags(remote[, options])` pushes local tags to a named remote (equivalent to using `.push([remote, '--tags'])`)
## git remote
- `.addRemote(name, repo, [options])` adds a new named remote to be tracked as `name` at the path `repo`, optionally with any supported [options](#how-to-specify-options) for the [git add](https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emaddem) call.
- `.getRemotes([verbose])` gets a list of the named remotes, supply the optional `verbose` option as `true` to include the URLs and purpose of each ref
- `.listRemote([options])` lists remote repositories - there are so many optional arguments in the underlying `git ls-remote` call, just supply any you want to use as the optional [options](#how-to-specify-options) eg: `git.listRemote(['--heads', '--tags'], console.log)`
- `.remote([options])` runs a `git remote` command with any number of [options](#how-to-specify-options)
- `.removeRemote(name)` removes the named remote
- `.addRemote(name, repo, [options])` adds a new named remote to be tracked as `name` at the path `repo`, optionally with any supported [options](#how-to-specify-options) for the [git add](https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emaddem) call.
- `.getRemotes([verbose])` gets a list of the named remotes, supply the optional `verbose` option as `true` to include the URLs and purpose of each ref
- `.listRemote([options])` lists remote repositories - there are so many optional arguments in the underlying `git ls-remote` call, just supply any you want to use as the optional [options](#how-to-specify-options) eg: `git.listRemote(['--heads', '--tags'], console.log)`
- `.remote([options])` runs a `git remote` command with any number of [options](#how-to-specify-options)
- `.removeRemote(name)` removes the named remote
## git reset
- `.reset(resetMode, [resetOptions])` resets the repository, sets the reset mode to one of the supported types (use a constant from
the exported `ResetMode` enum, or a string equivalent: `mixed`, `soft`, `hard`, `merge`, `keep`). Any number of other arguments
supported by [git reset](https://git-scm.com/docs/git-reset) can be supplied as an [options](#how-to-specify-options) object/array.
- `.reset(resetMode, [resetOptions])` resets the repository, sets the reset mode to one of the supported types (use a constant from
the exported `ResetMode` enum, or a string equivalent: `mixed`, `soft`, `hard`, `merge`, `keep`). Any number of other arguments
supported by [git reset](https://git-scm.com/docs/git-reset) can be supplied as an [options](#how-to-specify-options) object/array.
- `.reset(resetOptions)` resets the repository with the supplied [options](#how-to-specify-options)
- `.reset(resetOptions)` resets the repository with the supplied [options](#how-to-specify-options)
- `.reset()` resets the repository in `soft` mode.
- `.reset()` resets the repository in `soft` mode.
## git rev-parse / repo properties
- `.revparse([options])` sends the supplied [options](#how-to-specify-options) to [git rev-parse](https://git-scm.com/docs/git-rev-parse) and returns the string response from `git`.
- `.revparse([options])` sends the supplied [options](#how-to-specify-options) to [git rev-parse](https://git-scm.com/docs/git-rev-parse) and returns the string response from `git`.
- `.checkIsRepo()` gets whether the current working directory is a descendent of a git repository.
- `.checkIsRepo('bare')` gets whether the current working directory is within a bare git repo (see either [git clone --bare](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---bare) or [git init --bare](https://git-scm.com/docs/git-init#Documentation/git-init.txt---bare)).
- `.checkIsRepo('root')` gets whether the current working directory is the root directory for a repo (sub-directories will return false).
- `.checkIsRepo()` gets whether the current working directory is a descendent of a git repository.
- `.checkIsRepo('bare')` gets whether the current working directory is within a bare git repo (see either [git clone --bare](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---bare) or [git init --bare](https://git-scm.com/docs/git-init#Documentation/git-init.txt---bare)).
- `.checkIsRepo('root')` gets whether the current working directory is the root directory for a repo (sub-directories will return false).
## git status
- `.status([options])` gets the status of the current repo, resulting in a [StatusResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts). Additional arguments
supported by [git status](https://git-scm.com/docs/git-status) can be supplied as an [options](#how-to-specify-options) object/array.
- `.status([options])` gets the status of the current repo, resulting in a [StatusResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts). Additional arguments
supported by [git status](https://git-scm.com/docs/git-status) can be supplied as an [options](#how-to-specify-options) object/array.
## git submodule
- `.subModule(options)` Run a `git submodule` command with on or more arguments passed in as an [options](#how-to-specify-options) array or object
- `.submoduleAdd(repo, path)` Adds a new sub module
- `.submoduleInit([options]` Initialises sub modules, the optional [options](#how-to-specify-options) argument can be used to pass extra options to the `git submodule init` command.
- `.submoduleUpdate(subModuleName, [options])` Updates sub modules, can be called with a sub module name and [options](#how-to-specify-options), just the options or with no arguments
- `.subModule(options)` Run a `git submodule` command with on or more arguments passed in as an [options](#how-to-specify-options) array or object
- `.submoduleAdd(repo, path)` Adds a new sub module
- `.submoduleInit([options]` Initialises sub modules, the optional [options](#how-to-specify-options) argument can be used to pass extra options to the `git submodule init` command.
- `.submoduleUpdate(subModuleName, [options])` Updates sub modules, can be called with a sub module name and [options](#how-to-specify-options), just the options or with no arguments
## git stash
- `.stash([ options ])` Stash the working directory, optional first argument can be an array of string arguments or [options](#how-to-specify-options) object to pass to the [git stash](https://git-scm.com/docs/git-stash) command.
- `.stash([ options ])` Stash the working directory, optional first argument can be an array of string arguments or [options](#how-to-specify-options) object to pass to the [git stash](https://git-scm.com/docs/git-stash) command.
- `.stashList([ options ])` Retrieves the stash list, optional first argument can be an object in the same format as used in [git log](#git-log).
- `.stashList([ options ])` Retrieves the stash list, optional first argument can be an object in the same format as used in [git log](#git-log).
## changing the working directory [examples](https://github.com/steveukx/git-js/blob/main/examples/git-change-working-directory.md)
- `.cwd(workingDirectory)` Sets the working directory for all future commands - note, this will change the working for the root instance, any chain created from the root will also be changed.
- `.cwd({ path, root = false })` Sets the working directory for all future commands either in the current chain of commands (where `root` is omitted or set to `false`) or in the main instance (where `root` is `true`).
- `.cwd(workingDirectory)` Sets the working directory for all future commands - note, this will change the working for the root instance, any chain created from the root will also be changed.
- `.cwd({ path, root = false })` Sets the working directory for all future commands either in the current chain of commands (where `root` is omitted or set to `false`) or in the main instance (where `root` is `true`).

@@ -417,6 +419,6 @@ ## How to Specify Options

// results in 'git pull origin master --no-rebase'
git().pull('origin', 'master', {'--no-rebase': null})
git().pull('origin', 'master', { '--no-rebase': null });
// results in 'git pull origin master --rebase=true'
git().pull('origin', 'master', {'--rebase': 'true'})
git().pull('origin', 'master', { '--rebase': 'true' });
```

@@ -431,3 +433,3 @@

// results in 'git pull origin master --no-rebase'
git.pull('origin', 'master', ['--no-rebase'])
git.pull('origin', 'master', ['--no-rebase']);
```

@@ -443,3 +445,3 @@

- [release notes v2](https://github.com/steveukx/git-js/blob/main/docs/RELEASE-NOTES-V2.md)
- [release notes v2](https://github.com/steveukx/git-js/blob/main/docs/RELEASE-NOTES-V2.md)

@@ -452,6 +454,3 @@ # Concurrent / Parallel Requests

```typescript
simpleGit()
.init()
.addRemote('origin', 'https://some-repo.git')
.fetch();
simpleGit().init().addRemote('origin', 'https://some-repo.git').fetch();
```

@@ -472,3 +471,5 @@

]);
function swallow (err) { return null }
function swallow(err) {
return null;
}
```

@@ -482,6 +483,6 @@

const git = simpleGit({ maxConcurrentProcesses: 10 });
```
```
Treating tasks called on the root instance as the start of separate chains is a change to the behaviour of
`simple-git` and was added in version `2.11.0`.
`simple-git` and was added in version `2.11.0`.

@@ -499,6 +500,4 @@ # Complex Requests

simpleGit(path).raw(commands, (err, result) => {
// err is null unless this command failed
// result is the raw output of this command
});

@@ -519,9 +518,8 @@

const remote = `https://${ USER }:${ PASS }@${ REPO }`;
const remote = `https://${USER}:${PASS}@${REPO}`;
simpleGit()
.clone(remote)
.then(() => console.log('finished'))
.catch((err) => console.error('failed: ', err));
.clone(remote)
.then(() => console.log('finished'))
.catch((err) => console.error('failed: ', err));
```

@@ -538,12 +536,15 @@

```javascript
const GIT_SSH_COMMAND = "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no";
const GIT_SSH_COMMAND = 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no';
simpleGit()
.env('GIT_SSH_COMMAND', GIT_SSH_COMMAND)
.status((err, status) => { /* */ })
.env('GIT_SSH_COMMAND', GIT_SSH_COMMAND)
.status((err, status) => {
/* */
});
simpleGit().env({...process.env, GIT_SSH_COMMAND})
.status()
.then(status => { })
.catch(err => {});
simpleGit()
.env({ ...process.env, GIT_SSH_COMMAND })
.status()
.then((status) => {})
.catch((err) => {});
```

@@ -568,3 +569,3 @@

}
})
});
```

@@ -577,5 +578,4 @@

const mergeSummary = await git.merge();
console.log(`Merged ${ mergeSummary.merges.length } files`);
}
catch (err) {
console.log(`Merged ${mergeSummary.merges.length} files`);
} catch (err) {
// err.message - the string summary of the error

@@ -585,3 +585,3 @@ // err.stack - some stack trace detail

console.error(`Merge resulted in ${ err.git.conflicts.length } conflicts`);
console.error(`Merge resulted in ${err.git.conflicts.length} conflicts`);
}

@@ -593,10 +593,11 @@ ```

```javascript
const mergeSummary = await git.merge()
.catch(err => {
if (err.git) { return err.git; } // the unsuccessful mergeSummary
throw err; // some other error, so throw
});
const mergeSummary = await git.merge().catch((err) => {
if (err.git) {
return err.git;
} // the unsuccessful mergeSummary
throw err; // some other error, so throw
});
if (mergeSummary.failed) {
console.error(`Merge resulted in ${ mergeSummary.conflicts.length } conflicts`);
console.error(`Merge resulted in ${mergeSummary.conflicts.length} conflicts`);
}

@@ -610,14 +611,13 @@ ```

try {
const mergeSummary = await simpleGit().merge();
console.log(`Merged ${ mergeSummary.merges.length } files`);
const mergeSummary = await simpleGit().merge();
console.log(`Merged ${mergeSummary.merges.length} files`);
} catch (err) {
// err.message - the string summary of the error
// err.stack - some stack trace detail
// err.git - where a parser was able to run, this is the parsed content
const mergeSummary: MergeSummary = (err as GitResponseError<MergeSummary>).git;
const conflicts = mergeSummary?.conflicts || [];
console.error(`Merge resulted in ${conflicts.length} conflicts`);
}
catch (err) {
// err.message - the string summary of the error
// err.stack - some stack trace detail
// err.git - where a parser was able to run, this is the parsed content
const mergeSummary: MergeSummary = (err as GitResponseError<MergeSummary>).git;
const conflicts = mergeSummary?.conflicts || [];
console.error(`Merge resulted in ${ conflicts.length } conflicts`);
}
```

@@ -643,11 +643,11 @@

- `git` isn't available as a binary for the user running the main `node` process, custom paths to the binary can be used
with the `.customBinary(...)` api option.
- `git` isn't available as a binary for the user running the main `node` process, custom paths to the binary can be used
with the `.customBinary(...)` api option.
- the working directory passed in to the main `simple-git` function isn't accessible, check it is read/write accessible
by the user running the `node` process. This library uses
[@kwsites/file-exists](https://www.npmjs.com/package/@kwsites/file-exists) to validate the working directory exists,
to output its logs add `@kwsites/file-exists` to your `DEBUG` environment variable. eg:
- the working directory passed in to the main `simple-git` function isn't accessible, check it is read/write accessible
by the user running the `node` process. This library uses
[@kwsites/file-exists](https://www.npmjs.com/package/@kwsites/file-exists) to validate the working directory exists,
to output its logs add `@kwsites/file-exists` to your `DEBUG` environment variable. eg:
`DEBUG=@kwsites/file-exists,simple-git node ./your-app.js`
`DEBUG=@kwsites/file-exists,simple-git node ./your-app.js`

@@ -662,7 +662,7 @@ ### Log format fails

For more details of the supported tokens, please see the
[official `git log` documentation](https://git-scm.com/docs/git-log#_pretty_formats)
[official `git log` documentation](https://git-scm.com/docs/git-log#_pretty_formats)
### Log response properties are out of order
The properties of `git.log` are fetched using the character sequence ` ò ` as a delimiter. If your commit messages
The properties of `git.log` are fetched using the character sequence `ò` as a delimiter. If your commit messages
use this sequence, supply a custom `splitter` in the options, for example: `git.log({ splitter: '💻' })`

@@ -672,9 +672,9 @@

- Enable verbose logs with the environment variable `DEBUG=simple-git:task:*,simple-git:output:*`
- Check the output (for example: `simple-git:output:diff:1 [stdOut] 1 file changed, 1 insertion(+)`)
- Check the `stdOut` output is the same as you would expect to see when running the command directly in terminal
- Check the language used in the response is english locale
- Enable verbose logs with the environment variable `DEBUG=simple-git:task:*,simple-git:output:*`
- Check the output (for example: `simple-git:output:diff:1 [stdOut] 1 file changed, 1 insertion(+)`)
- Check the `stdOut` output is the same as you would expect to see when running the command directly in terminal
- Check the language used in the response is english locale
In some cases `git` will show progress messages or additional detail on error states in the output for
`stdErr` that will help debug your issue, these messages are also included in the verbose log.
`stdErr` that will help debug your issue, these messages are also included in the verbose log.

@@ -686,5 +686,5 @@ ### Legacy Node Versions

- `Object.fromEntries is not a function`
- `Object.entries is not a function`
- `message.flatMap is not a function`
- `Object.fromEntries is not a function`
- `Object.entries is not a function`
- `message.flatMap is not a function`

@@ -705,4 +705,4 @@ To resolve these issues, either upgrade to a newer version of node.js or ensure you are using the necessary polyfills

const subDirStatusUsingOptArray = await git.status(['--', 'sub-dir']);
const subDirStatusUsingOptObject = await git.status({'--': null, 'sub-dir': null});
```
const subDirStatusUsingOptObject = await git.status({ '--': null, 'sub-dir': null });
```

@@ -712,8 +712,7 @@ ### async await

```javascript
async function status (workingDir) {
async function status(workingDir) {
let statusSummary = null;
try {
statusSummary = await simpleGit(workingDir).status();
}
catch (e) {
} catch (e) {
// handle the error

@@ -726,3 +725,3 @@ }

// using the async function
status(__dirname + '/some-repo').then(status => console.log(status));
status(__dirname + '/some-repo').then((status) => console.log(status));
```

@@ -736,8 +735,7 @@

git.checkIsRepo()
.then(isRepo => !isRepo && initialiseRepo(git))
.then((isRepo) => !isRepo && initialiseRepo(git))
.then(() => git.fetch());
function initialiseRepo (git) {
return git.init()
.then(() => git.addRemote('origin', 'https://some.git.repo'))
function initialiseRepo(git) {
return git.init().then(() => git.addRemote('origin', 'https://some.git.repo'));
}

@@ -751,11 +749,10 @@ ```

.pull()
.tags((err, tags) => console.log("Latest available tag: %s", tags.latest));
.tags((err, tags) => console.log('Latest available tag: %s', tags.latest));
// update repo and when there are changes, restart the app
simpleGit()
.pull((err, update) => {
if (update && update.summary.changes) {
require('child_process').exec('npm restart');
}
});
simpleGit().pull((err, update) => {
if (update && update.summary.changes) {
require('child_process').exec('npm restart');
}
});
```

@@ -769,3 +766,3 @@

.add('./*')
.commit("first commit!")
.commit('first commit!')
.addRemote('origin', 'https://github.com/user/repo.git')

@@ -780,3 +777,3 @@ .push('origin', 'master');

.add('./*')
.commit("first commit!")
.commit('first commit!')
.addRemote('origin', 'some-repo-url')

@@ -793,5 +790,5 @@ .push(['-u', 'origin', 'master'], () => console.log('done'));

const git = simpleGit({
progress ({method, stage, progress}) {
console.log(`git.${ method } ${ stage } stage ${ progress }% complete`);
}
progress({ method, stage, progress }) {
console.log(`git.${method} ${stage} stage ${progress}% complete`);
},
});

@@ -808,5 +805,5 @@ git.checkout('https://github.com/user/repo.git');

.pull((err, update) => {
if (update && update.summary.changes) {
require('child_process').exec('npm restart');
}
if (update && update.summary.changes) {
require('child_process').exec('npm restart');
}
})

@@ -838,3 +835,5 @@ .exec(() => console.log('pull done.'));

.commit('committed as "Some One"', 'file-one')
.commit('committed as "Another Person"', 'file-two', {'--author': '"Another Person <another@person.com>"'});
.commit('committed as "Another Person"', 'file-two', {
'--author': '"Another Person <another@person.com>"',
});
```

@@ -845,9 +844,8 @@

```javascript
simpleGit()
.listRemote(['--get-url'], (err, data) => {
if (!err) {
console.log('Remote url for repository at ' + __dirname + ':');
console.log(data);
}
});
simpleGit().listRemote(['--get-url'], (err, data) => {
if (!err) {
console.log('Remote url for repository at ' + __dirname + ':');
console.log(data);
}
});
```

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc