MCPcopy Create free account
hub / github.com/cloudflare/agents / branch

Function branch

packages/shell/src/git/index.ts:203–225  ·  view source on GitHub ↗

git branch [--list] or git branch

(opts?: {
      name?: string;
      list?: boolean;
      delete?: string;
      dir?: string;
    })

Source from the content-addressed store, hash-verified

201
202 /** git branch [--list] or git branch <name> */
203 async branch(opts?: {
204 name?: string;
205 list?: boolean;
206 delete?: string;
207 dir?: string;
208 }) {
209 const d = resolveDir(opts?.dir);
210
211 if (opts?.delete) {
212 await git.deleteBranch({ fs, dir: d, ref: opts.delete });
213 return { deleted: opts.delete };
214 }
215
216 if (opts?.name) {
217 await git.branch({ fs, dir: d, ref: opts.name });
218 return { created: opts.name };
219 }
220
221 // List branches
222 const branches = await git.listBranches({ fs, dir: d });
223 const current = await git.currentBranch({ fs, dir: d });
224 return { branches, current };
225 },
226
227 /** git checkout <ref> or git checkout -b <branch> */
228 async checkout(opts: {

Callers 1

getToolsMethod · 0.85

Calls 2

resolveDirFunction · 0.85
branchMethod · 0.45

Tested by

no test coverage detected