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

2.0.1 • Public • Published

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'));
// => main

console.log(await defaultBranch('https://github.com/knutkirkhorn/btc-value-cli'));
// => main

console.log(await defaultBranch('https://enterprise.github.corp/org/repo'));
// => 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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.1
    140
    • latest

Version History

Package Sidebar

Install

npm i default-branch

Weekly Downloads

141

Version

2.0.1

License

MIT

Unpacked Size

4.6 kB

Total Files

5

Last publish

Collaborators

  • knutkirkhorn