default-branch
Get the default branch of a GitHub repository
Installation
npm install default-branch
Usage
import defaultBranch from 'default-branch';
console.log(await defaultBranch('knutkirkhorn/emorjis'));
console.log(await defaultBranch('https://github.com/knutkirkhorn/btc-value-cli'));
console.log(await defaultBranch('https://enterprise.github.corp/org/repo'));
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