https://github.com/jonschlinkert/list-git-branches
List the branches for a git repository.
https://github.com/jonschlinkert/list-git-branches
branches git javascript jonschlinkert node
Last synced: 7 months ago
JSON representation
List the branches for a git repository.
- Host: GitHub
- URL: https://github.com/jonschlinkert/list-git-branches
- Owner: jonschlinkert
- License: mit
- Created: 2017-04-20T03:23:53.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-28T07:54:16.000Z (over 7 years ago)
- Last Synced: 2025-02-26T18:49:43.495Z (7 months ago)
- Topics: branches, git, javascript, jonschlinkert, node
- Language: JavaScript
- Homepage: https://github.com/jonschlinkert/list-git-branches
- Size: 9.77 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: .github/contributing.md
- License: LICENSE
Awesome Lists containing this project
README
# list-git-branches [](https://www.npmjs.com/package/list-git-branches) [](https://npmjs.org/package/list-git-branches) [](https://npmjs.org/package/list-git-branches) [](https://travis-ci.org/jonschlinkert/list-git-branches)
> List the branches for a git repository.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save list-git-branches
```Install with [yarn](https://yarnpkg.com):
```sh
$ yarn add list-git-branches
```## Usage
```js
var branches = require('list-git-branches');
var cwd = '.';// async
branches(cwd, function(err, res) {
if (err) throw err;
console.log(res);
});// sync
console.log(branches.sync(cwd));
```You can optionally pass an options object as the second argument, to be passed to `.exec` or `.execSync`.
## About
### Related projects
* [gfc](https://www.npmjs.com/package/gfc): Simple way to initialize a new git repository in an empty directory, add a file… [more](https://github.com/jonschlinkert/gfc) | [homepage](https://github.com/jonschlinkert/gfc "Simple way to initialize a new git repository in an empty directory, add a file and do a first commit (or skip that part in a directory with files). Useful for unit tests and generators.")
* [git-add-remote](https://www.npmjs.com/package/git-add-remote): API for adding git remotes. | [homepage](https://github.com/jonschlinkert/git-add-remote "API for adding git remotes.")
* [git-branch](https://www.npmjs.com/package/git-branch): Get the current branch for a local git repository. | [homepage](https://github.com/jonschlinkert/git-branch "Get the current branch for a local git repository.")
* [git-config-path](https://www.npmjs.com/package/git-config-path): Resolve the path to the user's local or global .gitconfig. | [homepage](https://github.com/jonschlinkert/git-config-path "Resolve the path to the user's local or global .gitconfig.")
* [git-user-email](https://www.npmjs.com/package/git-user-email): Get the email address of the current user from git config. | [homepage](https://github.com/jonschlinkert/git-user-email "Get the email address of the current user from git config.")
* [git-user-name](https://www.npmjs.com/package/git-user-name): Get a user's name from git config at the project or global scope, depending on… [more](https://github.com/jonschlinkert/git-user-name) | [homepage](https://github.com/jonschlinkert/git-user-name "Get a user's name from git config at the project or global scope, depending on what git uses in the current context.")
* [git-username](https://www.npmjs.com/package/git-username): Get the username from a git remote origin URL. | [homepage](https://github.com/jonschlinkert/git-username "Get the username from a git remote origin URL.")
* [list-git-remotes](https://www.npmjs.com/package/list-git-remotes): List the remotes for a local git repository. Sync and async. | [homepage](https://github.com/jonschlinkert/list-git-remotes "List the remotes for a local git repository. Sync and async.")### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
### Building docs
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```### Running tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```### Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)### License
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 19, 2017._