diff --git a/src/helpers/git.ts b/src/helpers/git.ts index b0120e1..282325a 100644 --- a/src/helpers/git.ts +++ b/src/helpers/git.ts @@ -107,7 +107,7 @@ export default class Git { * @throws {Error} if the checkout failed. */ async checkout(branch: string) { - await execa('git', ['checkout', branch], this.execaOpts); + await execa('git', ['checkout', '-B', branch], this.execaOpts); } /** diff --git a/test/helpers/git.test.ts b/test/helpers/git.test.ts index a4a6991..2137d2d 100644 --- a/test/helpers/git.test.ts +++ b/test/helpers/git.test.ts @@ -87,7 +87,7 @@ describe("git", () => { await subject.checkout('develop'); expect(execa).toHaveBeenCalledWith( 'git', - ['checkout', 'develop'], + ['checkout', '-B', 'develop'], expect.objectContaining(execaOpts) ); });