🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

git-rev-sync

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
g

git-rev-sync

Synchronously get the current git commit hash, tag, or branch

3.0.2
latest
100

Supply Chain Security

100

Vulnerability

98

Quality

77

Maintenance

100

License

Shell access

Supply chain risk

This module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.

Found 1 instance in 1 package

Dependencies have 4 high alerts.

Socket optimized override available

Version published
Weekly downloads
265K
11.31%
Maintainers
1
Weekly downloads
 
Created
Issues
22

What is git-rev-sync?

The git-rev-sync npm package provides synchronous access to Git repository information, such as the current branch, commit hash, and other metadata. It is useful for embedding Git information into your application, such as for versioning or debugging purposes.

What are git-rev-sync's main functionalities?

Get the current branch name

This feature allows you to retrieve the name of the current branch in the Git repository.

const git = require('git-rev-sync');
const branch = git.branch();
console.log(branch);

Get the current commit hash

This feature allows you to get the full hash of the current commit.

const git = require('git-rev-sync');
const commit = git.long();
console.log(commit);

Get the short commit hash

This feature provides the short version of the current commit hash.

const git = require('git-rev-sync');
const shortCommit = git.short();
console.log(shortCommit);

Get the commit message

This feature retrieves the commit message of the current commit.

const git = require('git-rev-sync');
const message = git.message();
console.log(message);

Get the commit date

This feature allows you to get the date of the current commit.

const git = require('git-rev-sync');
const date = git.date();
console.log(date);

Other packages similar to git-rev-sync

FAQs

Package last updated on 19 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts