我整个上午都在尝试使用nodegit打开一个已存在的仓库并切换分支或标签,但是文档看起来很详细但似乎已经过时了。你们有什么想法吗?
var NodeGit = require("nodegit");
var open = NodeGit.Repository.open;
var Tag = NodeGit.Tag;
var Checkout = NodeGit.Checkout;
open(location).then(function (repo) {
Tag.list(repo).then(function(array) {
// array is ['v1.0.0']
var ref = array[0]
Checkout.tree(repo, ref).then(function() {
// Want tag to be checked out out in detached state.
});
});
});