Skip to content

Instantly share code, notes, and snippets.

@jackyef
Last active October 20, 2019 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackyef/9996bf06fc7b59619b66e271f66b4c21 to your computer and use it in GitHub Desktop.
Save jackyef/9996bf06fc7b59619b66e271f66b4c21 to your computer and use it in GitHub Desktop.
const child = require('child_process');
const output = child.execSync(`git log --format=%B%H----DELIMITER----`).toString('utf-8');
const commitsArray = output.split('----DELIMITER----\n').map(commit => {
const [message, sha] = commit.split('\n');
return { sha, message };
}).filter(commit => Boolean(commit.sha));
console.log({ commitsArray });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment