Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async checkoutOrCreate(branchName: string): Promise {
console.log(`[GitManager] Checking out "${this.localUserBranch}"...`);
try {
await this._checkout(branchName);
} catch(err) {
await branch({
dir: this.projectDir,
ref: branchName
});
await this._checkout(branchName);
await push({
dir: this.projectDir,
ref: branchName,
username: this.username,
password: this.password
});
}
}
export async function createBranch(
projectRoot: string,
newBranchName: string
): Promise {
return git.branch({ dir: projectRoot, ref: newBranchName })
}
export async function createBranch(
projectRoot: string,
newBranchName: string
): Promise {
return git.branch({ fs, dir: projectRoot, ref: newBranchName })
}