Would appreciate some help with nodegit. I got it to checkout a branch (branch-development-modular-alpha-2.0.0) with:
var cloneRepo = nodegit
.Clone(cloneURL, repoPath, cloneOptions)
.then(function (repo) {
  repo.getBranch('refs/remotes/origin/' + branch).then(function(reference) {
    repo.checkoutRef(reference);
    // Go through repo's submodules
    nodegit.Submodule.foreach(repo, function (submodule) {
      var submoduleName = submodule.name();
      var submoduleURL = submodule.url();
      var submodulePath = repoPath + "/" + submodule.path();
      // Clone the submodule
      nodegit
      .Clone(submoduleURL, submodulePath, cloneOptions)
      .then(function (repo) {
        // TODO: DO SOMETHING.
      })
    })
  })
})
Now I'd like to pull the changes from the same branch and I have something like this however it's not updating with the latest changes from the branch.
nodegit
.Repository
.open(path.resolve(__dirname, repoPath))
.then(function (repo) {
  existingRepository = repo;
  return existingRepository.fetchAll(cloneOptions.fetchOpts);
})
.then(function () {
  return existingRepository.mergeBranches('master', 'refs/remotes/origin/' + branch);
})
.catch(function(error) {
  console.log(error);
})
What am I doing wrong?
 
     
     
    