Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
git-last-commit
Advanced tools
The git-last-commit npm package allows you to retrieve information about the last commit in a Git repository. This can be useful for various purposes such as displaying the last commit details in your application, automating release notes, or tracking changes.
Retrieve Last Commit Information
This feature allows you to retrieve the details of the last commit in the repository. The callback function provides an object containing information such as the commit hash, author, date, and message.
const git = require('git-last-commit');
git.getLastCommit(function(err, commit) {
console.log(commit);
});
Custom Options
You can specify custom options such as the source and destination directories. This is useful if you want to get the last commit information from a specific directory.
const git = require('git-last-commit');
const options = {
dst: __dirname,
src: __dirname
};
git.getLastCommit(function(err, commit) {
console.log(commit);
}, options);
simple-git is a lightweight interface for running Git commands in any node.js application. It provides a more comprehensive set of Git functionalities compared to git-last-commit, including commit history, branch management, and more.
nodegit is a native Node.js library for Git. It offers a wide range of Git functionalities, including commit history, branch management, and repository manipulation. It is more feature-rich and complex compared to git-last-commit.
isomorphic-git is a pure JavaScript implementation of Git that works in both Node.js and browser environments. It provides a comprehensive set of Git functionalities and is more versatile compared to git-last-commit.
Node.js module to read last git commit information including tags and branch - mostly to be used by continuous integration and build systems for build tagging purposes.
var git = require('git-last-commit');
git.getLastCommit(function(err, commit) {
// read commit object properties
console.log(commit);
});
Function returns an object like this:
{
"shortHash": "d2346fa",
"hash": "d2346faac31de5e954ef5f6baf31babcd3e899f2",
"subject": "initial commit",
"sanitizedSubject": "initial-commit",
"body": "this is the body of the commit message",
"authoredOn": "1437988060",
"committedOn": "1437988060",
"author": {
"name": "Ozan Seymen",
"email": "oseymen@gmail.com"
},
"committer": {
"name": "Ozan Seymen",
"email": "oseymen@gmail.com"
},
"notes": "commit notes",
"branch": "master",
"tags": ['R1', 'R2']
}
You can add path destination if you want to get git last commit information on another repository:
var git = require('git-last-commit');
git.getLastCommit(function(err, commit) {
// read commit object properties
console.log(commit);
}, {dst: 'some/other/path'});
Function uses comma as the format separator for the git log
command output. You can customise this by providing another character using splitChar
option:
var git = require('git-last-commit');
git.getLastCommit(function(err, commit) {
// read commit object properties
console.log(commit);
}, {splitChar: '|'});
FAQs
Read details of the last commit including tags
The npm package git-last-commit receives a total of 133,830 weekly downloads. As such, git-last-commit popularity was classified as popular.
We found that git-last-commit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.