2.0.1 • Published 6 years ago

git-branch v2.0.1

Weekly downloads
82,683
License
MIT
Repository
github
Last release
6 years ago

git-branch NPM version NPM monthly downloads NPM total downloads Linux Build Status

Get the current branch from the local git repository.

Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.

Install

Install with npm:

$ npm install --save git-branch

Usage

const branch = require('git-branch');

Optionally pass the cwd (current working directory) as the first argument.

Promise

branch('some/path')
  .then(name => console.log('Branch:', name)) //=> 'master'
  .catch(console.error);

Callback

branch(function(err, name) {
  if (err) throw err;
  console.log('Branch:', name); //=> 'master'
});

Sync

console.log('Branch:', branch.sync()); //=> 'master'

About

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

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:

$ npm install && npm test

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Related projects

You might also be interested in these projects:

Contributors

CommitsContributor
19jonschlinkert
6emilrowland

Author

Jon Schlinkert

License

Copyright © 2018, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on March 09, 2018.

da-commitizen-config@findaway/sandbox@outcome-co/gh-action-helpershyperia-commitizer@dewen_li/gatsby-theme-bodiless@cfchase/interactive-landscapecypress-lib@everything-registry/sub-chunk-1760@edgelogistics/cz-conventional-changelogweexplusto.pinf.org.mozilla.web-exttinij-base@evdy-consumer/cloudcms-workflow@endemolshinegroup/cz-jira-smart-commit@fusionary/fmtsuphookvscode-github-file-folder-urlvite-plugin-deadcodesverb-generate-readmetrismfast-jira-commit@itsjonq/prestarttchin-react-components@haaretz/cz-htz@helpscout/prestartcommitizen-jiraci-helper@designsystemsinternational/cli-utilscli-invokeps1genpublish-jenkinesraml-1-parser-test-utilss3-streamloggersc-version-discoverabilityschematics-readmesiroccosonar-clistash-prbranch-check-clicli-time-tracker@dgc-org/cz-conventional-changelog-for-jiracodesandboxstrapi-neon-tech-db-branchesgit-to-github-urlgit-push-prgitline@mingshz/local-api-mocker@lfnetworking/interactive-landscapegenerator-mypuregatsby-remark-codesandboxgitcgit-goodgit-is-branch-protectedgit-gudgit-hook-jira-idgit-jira-cligitlab-mergegitlab-cmd@mikojs/configs@opentribe/scripts_main@elob/gitpr@fishawack/config-grunt@fishawack/lab-env@focusworkstemp/project-utils@jouwweb/better-crowdin@leethais91/cz-conventional-changelog-for-redmine@netdata/interactive-landscapekemitbetter-crowdinnetdata-collectors-landscape@bolt/build-slacknetlify-localmocha-testrail-reporter-plus@bufferapp/composer-auto-pr@blue-tomato/cz-jira-conventional-changelognessbmw-vue-vsee@appworks/project-utilsmy-czautorelease@barath/bbk-stacks@batatinha-delivery/cz-conventional-changeloglandr@zambezi/gitbook-plugin-zambezi-docs@colorless/cli@colorless/release-script@connorbrathwaite/cz-conventional-jira-smart-commit@codesherpas/ghprnpm-publish-scriptscheck-branches@asemirsk/gatsby-theme-bodiless@availworks/project-utilsadeng-jenkins-clibuild-metabuild-records-webpack-pluginbmangoder-clicagip-interactive-landscapebitb-prbitbucket-pullr
2.0.1

6 years ago

2.0.0

6 years ago

1.0.0

7 years ago

0.3.0

9 years ago

0.2.0

9 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago