3.0.2 • Published 2 years ago

git-rev-sync v3.0.2

Weekly downloads
585,958
License
MIT
Repository
github
Last release
2 years ago

git-rev-sync Build Status

Synchronously get the current git commit hash, tag, count, branch or commit message. Forked from git-rev. Supports Node 4+.

Example

var git = require('git-rev-sync');

console.log(git.short());
// 75bf4ee

console.log(git.long());
// 75bf4eea9aa1a7fd6505d0d0aa43105feafa92ef

console.log(git.branch());
// master

You can also run these examples via: npm run examples

Install

npm install git-rev-sync --save

API

var git = require('git-rev-sync');

git.short([filePath], [length]) <String>

return the result of git rev-parse --short HEAD

  • optional filePath parameter can be used to run the command against a repo outside the current working directory
  • optional length parameter can be used to set the desired hash length (defaults to 7)

git.long([filePath]) <String>

return the result of git rev-parse HEAD; optional filePath parameter can be used to run the command against a repo outside the current working directory

git.branch([filePath]) <String>

return the current branch; optional filePath parameter can be used to run the command against a repo outside the current working directory

git.count() <Number>

return the count of commits across all branches; this method will fail if the git command is not found in PATH

git.date() <Date>

returns the date of the current commit; this method will fail if the git command is not found in PATH

git.hasUnstagedChanges() <Boolean>

returns true if there are unstaged changes; this method will fail if the git command is not found in PATH

git.isDirty() <Boolean>

returns true if there are uncommitted changes; this method will fail if the git command is not found in PATH

git.isTagDirty() <Boolean>

returns true if the current tag is dirty; this method will fail if the git command is not found in PATH

git.message() <String>

return the current commit message; this method will fail if the git command is not found in PATH

git.remoteUrl() <String>

return the current remote URL; this method will fail if the git command is not found in PATH

git.tag([markDirty]) <String>

return the current tag and mark as dirty if markDirty is truthful; this method will fail if the git command is not found in PATH

License

MIT

Donations

We're all in this together

@frondjs/dev-opsexpofp2@sourpatch/loggerryoma_rssreact-microservice-scriptsservice-feature-flags@sherlo/storybook-cli@sherlo/storybook-react-native-cli@infinitebrahmanuniverse/nolb-git-rrsshub@everything-registry/sub-chunk-1761orijsosu-tools-setupokki-extensionomni-common-uipaniknmmes-clinodecgparticles-amazon-amiparticles-cloudsploit-scansparticles-ec2particles-enhanced-snapshotsparticles-lambdaparticles-rancherparticles-rdsparticles-spotinstparticles-spotinst-lambdaparticles-vpcpeeracleoddishpolywoo-git-linkperformance-metricspinion-pipelinemonkeymanprogressive-web-sdk@devprice/version-from-gitbithound@cequens/react-scriptsbio-scaffoldblamo@carforyou/deploy@coupler/cli@craigrmccown/apollo@cliqz-oss/web-ext@dreamcatcher-tech/webdosbtrz-express-basecatbee-i18n-clicellular-scriptscavehousecetus-cli@zalastax/nolb-git-rwebaversewebpack-config-build-infowebpack-hot-release@apollographql/clizeropack-plugin-git-revart-compiler-ssrzenika-formation-frameworkart-webpackautochecker@bibigpt/rsshubaws-fed-deployment@asman/fl@asman/ft@bldr/core@bldr/core-node@vegaprotocol/approbationapi-ldapapollo-persisted-hashapollo@sherlo/clixhy_nftxu-fetarc-apolloapp.io@stackstorm/st2-build@x-scaffold/webpack-manifest-deployvue-markdown-book@todesktop/cli@tmorin_sfcc/pwa-kit-react-sdk@gnosis.pm/dx-services@haravan/cli@haoqimao/tibox-clicodeship-git-rev-sync@lphal/vite-plugin-git-info@mapbox/lambda-cfnfit-commit-js@sherlo/react-nativegit-hash-packagegit-rev-cligitbook-plugin-gitversiongulp-buildinfo-replacegulp-npm-buildinfo-replacehc-version-txthashed-envgrevflowdock-deploy-notifyhi-pkg-scriptsgitmdhanoman-ldi
3.0.2

2 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.12.0

6 years ago

1.11.2

6 years ago

1.11.1

6 years ago

1.11.0

6 years ago

1.10.0

6 years ago

1.9.1

7 years ago

1.9.0

7 years ago

1.8.0

8 years ago

1.7.1

8 years ago

1.7.0

8 years ago

1.6.0

8 years ago

1.5.1

8 years ago

1.5.0

8 years ago

1.4.0

9 years ago

1.3.0

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago