I'm trying to reproduce the checkout file operation using nodegit for reverting current changes of a file.
git checkout -- filename.ext
My first attempt was to use checkoutRef function from Repository object, like this:
nodegit.Repository.open(gitRepo)
.then(function (repo) {
repo.checkoutRef('filename.ext',{
checkoutStrategy: nodegit.Checkout.STRATEGY.FORCE
}).then(function (data) {
console.log(data);
});
});