Created
March 26, 2018 01:01
-
-
Save daikiojm/09c3d659206fcc4a98f01ecf256b9736 to your computer and use it in GitHub Desktop.
git_command_in_node
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 { spawn } = require('child_process'); | |
const ls = spawn('git', ['rev-parse', 'HEAD']); | |
ls.stdout.setEncoding('utf-8').on('data', (data) => { | |
const res = data.replace(/\r?\n|\r\n/g, ''); | |
console.log(`${res}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment