title: nodeJS: git pull, commit and push with child process
body: <p>I would like to git pull, commit and push from nodeJS with child_process - is this suppose to work?</p>
  
  <pre><code>var cmd = require('child_process');
  var commmandString = "cd c:\\xampp\\htdocs\\MenuMakerServer\\experiments\\editormenu &amp;&amp; git commit -am 'menu.json changes'    &amp;&amp; git push origin main";
  
   cmd.exec(commmandString , function (error: any, stdout, stderr) {
          if (error) {
              callback(error.stack, null);
          }
      });
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>OK,
  I managed to get this to work:</p>
  
  <pre><code>var sys = require('sys')
  var exec = require('child_process').exec;
  function puts(error, stdout, stderr) { sys.puts(stdout) }
  
  var options = {cwd:"c:\\xampp\\htdocs\\MenuMakerServer\\projects\\editormenu"};
  
  exec("git status &amp;&amp; git pull &amp;&amp; git commit -am 'menu changed' &amp;&amp; git push", options, puts);
  </code></pre>