Function checkout

  • Checkout a branch.

    If the branch already exists it will check out that branch. Otherwise, it will create a new remote tracking branch set to track the remote branch of that name.

    Returns

    Resolves successfully when filesystem operations are complete.

    Example

    // switch to the main branch
    await checkout({
    fs,
    dir: '/tutorial',
    ref: 'main'
    })

    Example

    // restore the 'docs' and 'src/docs' folders to the way they were, overwriting any changes
    await checkout({
    fs,
    dir: '/tutorial',
    force: true,
    filepaths: ['docs', 'src/docs']
    })

    Example

    // restore the 'docs' and 'src/docs' folders to the way they are in the 'develop' branch, overwriting any changes
    await checkout({
    fs,
    dir: '/tutorial',
    ref: 'develop',
    noUpdateHead: true,
    force: true,
    filepaths: ['docs', 'src/docs']
    })

    Parameters

    Returns Promise<void>

Generated using TypeDoc