code: function checkOutTag(repo, tag) {
    return git.Reference.dwim(repo, 'refs/tags/' + tag)
      .then(function(ref) {
        return ref.peel(git.Object.TYPE.COMMIT);
      })
      .then(function(ref) {
        return repo.getCommit(ref);
      })
      .then(function(commit) {
        return git.Checkout.tree(repo, commit, {
          checkoutStrategy: git.Checkout.STRATEGY.FORCE
        }).then(function() {
          return repo.setHeadDetached(commit, repo.defaultSignature, 'Checkout: HEAD ' + commit.id());
        });
      });
  }
docs: https://stackoverflow.com/a/46140283/1559386