default-branch
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.1 • Public • Published

    default-branch

    Get the default branch of a GitHub repository

    Installation

    $ npm install default-branch
    

    Usage

    const defaultBranch = require('default-branch');
    
    defaultBranch('knutkirkhorn/emorjis').then(branch => {
        console.log(branch);
        // => main
    });
    
    defaultBranch('https://github.com/knutkirkhorn/btc-value-cli').then(branch => {
        console.log(branch);
        // => main
    });
    
    defaultBranch('https://enterprise.github.corp/org/repo').then(branch => {
        console.log(branch);
        // => default
    });

    API

    defaultBranch(path)

    Returns the default branch of a repository. The path can be username/repo-name, or a full url to the repository (example: https://github.com/knutkirkhorn/btc-value-cli).

    Related

    License

    MIT © Knut Kirkhorn

    Install

    npm i default-branch

    DownloadsWeekly Downloads

    119

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    5.15 kB

    Total Files

    5

    Last publish

    Collaborators

    • knutkirkhorn