MCPcopy Index your code
hub / github.com/changesets/changesets / switchToMaybeExistingBranch

Function switchToMaybeExistingBranch

packages/release-utils/src/gitUtils.ts:37–51  ·  view source on GitHub ↗
(
  branch: string,
  cwd: string
)

Source from the content-addressed store, hash-verified

35};
36
37export const switchToMaybeExistingBranch = async (
38 branch: string,
39 cwd: string
40) => {
41 let { stderr } = await execWithOutput("git", ["checkout", branch], {
42 ignoreReturnCode: true,
43 cwd,
44 });
45 let isCreatingBranch = !stderr
46 .toString()
47 .includes(`Switched to a new branch '${branch}'`);
48 if (isCreatingBranch) {
49 await execWithOutput("git", ["checkout", "-b", branch], { cwd });
50 }
51};
52
53export const reset = async (
54 pathSpec: string,

Callers

nothing calls this directly

Calls 1

execWithOutputFunction · 0.90

Tested by

no test coverage detected