https://github.com/knutkirkhorn/default-branch
Get the default branch of a GitHub repository
https://github.com/knutkirkhorn/default-branch
branch default github github-enterprise nodejs repository
Last synced: about 1 month ago
JSON representation
Get the default branch of a GitHub repository
- Host: GitHub
- URL: https://github.com/knutkirkhorn/default-branch
- Owner: knutkirkhorn
- License: mit
- Created: 2018-01-03T15:42:41.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2023-05-08T21:26:56.000Z (over 2 years ago)
- Last Synced: 2025-08-15T05:43:03.394Z (2 months ago)
- Topics: branch, default, github, github-enterprise, nodejs, repository
- Language: JavaScript
- Homepage:
- Size: 124 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# default-branch
> Get the default branch of a GitHub repository
## Installation
```
npm install default-branch
```## Usage
```js
import defaultBranch from 'default-branch';console.log(await defaultBranch('knutkirkhorn/emorjis'));
// => mainconsole.log(await defaultBranch('https://github.com/knutkirkhorn/btc-value-cli'));
// => mainconsole.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
- [has-license](https://github.com/knutkirkhorn/has-license) - Check if a repository has a license
- [gh-repo-has-license](https://github.com/knutkirkhorn/gh-repo-has-license) - Check if a GitHub repository has a license