Hello @kartik,
Try this:
revision = require('child_process')
.execSync('git rev-parse HEAD')
.toString().trim()
and if you want to manually specify the root directory of the git project, use the second argument of execSync to pass the cwd option, like execSync('git rev-parse HEAD', {cwd: __dirname})
Hope it helps!!
Thank You!!