Skip to content

simple git

Created: 2018-09-19 11:19:52 -0700 Modified: 2018-09-19 11:20:34 -0700

Just writing down how I used this since I’m now deleting it from the code:

const simpleGit = require('simple-git')();
function commitToGit() {
const extraOptions = {
// '--dry-run': true,
};
const message = 'Update asset maps';
const filesToCommit = [assetMapPubPath, assetMapPrivPath];
simpleGit.commit(message, filesToCommit, extraOptions, (error, data) => {
if (_.isNil(error)) {
console.log(
`Successfully committed ${_.size(filesToCommit)} file(s) to git.`
);
} else {
console.error('Error committing to git:', error);
}
});
}