Created
December 13, 2019 10:22
-
-
Save robyoder/2e439f5bbe229e24482b72ab6754daaf to your computer and use it in GitHub Desktop.
A quick script to get the overall diff size between the current HEAD and master
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 child_process = require("child_process"); | |
const output = child_process.execSync("git diff HEAD master --shortstat", { encoding: "utf8" }); | |
// "6 files changed, 34 insertions(+), 4 deletions(-)" | |
const matches = output.match(/\s*\d+ files? changed, (\d+)\D+(\d+)?/) | |
// console.log(matches); | |
const sum = matches ? parseInt(matches[1]) + (parseInt(matches[2]) || 0) : 0; | |
console.log("\x1b[0m" + sum); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment