I'm executing a few git commands in sequence, in particular, I'm following a git flow model,
e.g. when finishing a feature, I run,
git pull
git push -u origin branchname
git pull origin develop
git checkout develop
git merge branchname
git push
I run these commands using the exec
module in node.js and I chain them one after another, like:
exec(command1,
(err, stdout, stderr) => {
if(err != null) {
//display an error message
return
} else {
exec(command2, (err, stdout, stderr) =>{ ... }
}
}
)
And so on. The outputs are working correctly and the order is working. However, if one of those commands fail, I am breaking out of the chain.
I know that there is an async library that I could use with the same effect, per here. However, is this the best possible way to do that without resorting to a third-party library? How have other people done it?