Skip to content

knutkirkhorn/default-branch

Repository files navigation

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

About

Get the default branch of a GitHub repository

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •