Created
January 24, 2019 12:50
-
-
Save kulakowka/4b5c5cf45a631ee2332b467366c36ab2 to your computer and use it in GitHub Desktop.
Getting a commit hash in node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const git = require("git-rev-sync"); | |
console.log(git.short()); | |
// 75bf4ee | |
console.log(git.long()); | |
// 75bf4eea9aa1a7fd6505d0d0aa43105feafa92ef | |
console.log(git.branch()); | |
// master | |
/** | |
GIT_REV=`git rev-parse --short HEAD` npm start | |
*/ | |
console.log(process.env.GIT_REV) | |
// 75bf4ee |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.slice(0, 7);