Function listBranches

  • List branches.

    By default it lists local branches. If a 'remote' is specified, it lists the remote's branches. When listing remote branches, the HEAD branch is not filtered out, so it may be included in the list of results.

    Note that specifying a remote does not actually contact the server and update the list of branches. If you want an up-to-date list, first do a fetch to that remote. (Which branch you fetch doesn't matter - the list of branches available on the remote is updated during the fetch handshake.)

    Returns

    Resolves successfully with an array of branch names.

    Example

    const branches = await listBranches({ fs, dir: '/tutorial' })
    console.log(branches)
    const remoteBranches = await listBranches({ fs, dir: '/tutorial', remote: 'origin' })
    console.log(remoteBranches)

    Parameters

    Returns Promise<string[]>

Generated using TypeDoc