First time using NodeGit and having issues with the Reset function.
I'm trying to reset a folder that has been cloned to the current HEAD of origin/master.
Even though i'm giving it a target, it says it's still required:
Error: Object target is required.
Current code:
var Reset = nodegit.Reset;
var templateDir = this.templatePath('/folder');
nodegit.Repository.open(templateDir)
.then(function(repo) {
repository = repo;
Reset.reset(repository, templateDir, Reset.TYPE.HARD, {
remoteCallbacks: {
credentials: function(url, userName) {
return nodegit.Cred.sshKeyNew(userName, sshPublicKey, sshPrivateKey, "");
}
}
})
.done(function(repo) {
console.log("reset done");
});
});
templateDir is the full path to the folder using Yeoman's templatePath.
Wondering if anyone can give me insight into what i'm doing wrong or missing. I didn't see an example for this in their Example folder.
My expected end result would be equal to running this in terminal:
git reset --hard origin/master