MCPcopy
hub / github.com/coder/mux / listLocalBranches

Function listLocalBranches

src/node/git.ts:50–64  ·  view source on GitHub ↗
(projectPath: string)

Source from the content-addressed store, hash-verified

48}
49
50export async function listLocalBranches(projectPath: string): Promise<string[]> {
51 using proc = execFileAsync("git", [
52 "-C",
53 projectPath,
54 "for-each-ref",
55 "--format=%(refname:short)",
56 "refs/heads",
57 ]);
58 const { stdout } = await proc.result;
59 return stdout
60 .split("\n")
61 .map((line) => line.trim())
62 .filter((line) => line.length > 0)
63 .sort((a, b) => a.localeCompare(b));
64}
65
66export async function getCurrentBranch(projectPath: string): Promise<string | null> {
67 try {

Callers 12

git.test.tsFile · 0.90
createWorkspaceMethod · 0.90
listBranchesMethod · 0.90
gitInitMethod · 0.90
createMethod · 0.90
forkMethod · 0.90
resolveTrunkBranchFunction · 0.90
detectDefaultTrunkBranchFunction · 0.85
createWorktreeFunction · 0.85

Calls 1

execFileAsyncFunction · 0.90

Tested by

no test coverage detected