Installations
npm install @adam-lynch/git-rev-sync
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
12.16.1
NPM Version
6.13.4
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
kurttheviking
Download Statistics
Total Downloads
417
Last Day
2
Last Week
2
Last Month
9
Last Year
79
GitHub Statistics
171 Stars
165 Commits
59 Forks
4 Watching
3 Branches
2 Contributors
Bundle Size
74.34 kB
Minified
23.79 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.0.0-0
Package Id
@adam-lynch/git-rev-sync@3.0.0-0
Unpacked Size
13.04 kB
Size
4.48 kB
File Count
9
NPM Version
6.13.4
Node Version
12.16.1
Total Downloads
Cumulative downloads
Total Downloads
417
Last day
0%
2
Compared to previous day
Last week
100%
2
Compared to previous week
Last month
50%
9
Compared to previous month
Last year
-39.2%
79
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
3
git-rev-sync ![Build Status](https://travis-ci.org/kurttheviking/git-rev-sync-js.svg?branch=master)
Synchronously get the current git commit hash, tag, count, branch or commit message. Forked from git-rev.
Example
1var git = require('git-rev-sync'); 2 3console.log(git.short()); 4// 75bf4ee 5 6console.log(git.long()); 7// 75bf4eea9aa1a7fd6505d0d0aa43105feafa92ef 8 9console.log(git.branch()); 10// master
You can also run these examples via: npm run examples
Install
npm install git-rev-sync --save
API
1var 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 to7
)
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.isDrty()
→ <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
Donations
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
1 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
Reason
Found 10/29 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 11 are checked with a SAST tool
Score
3.3
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More