我想克隆到本地文件系統的回購,然後簽出特定的提交。
這是我有:如何使用提交版本更新本地路徑?
Git.Clone(GIT_REPO_URL, localPath, CLONE_OPTIONS).then((repo) => {
return repo.getCommit(version).then((commit) => {
// use the local tree
});
}).catch((error) => {
// handler clone failure
});
這個克隆的回購只是罰款,但當地版本我最終是主的現任掌門人,而不是我簽出(version
)提交。
如何更新本地樹以匹配此提交?
謝謝。
你不需要檢查提交嗎?那是什麼'getCommit'呢?雖然它會讓你處於獨立的狀態...... – evolutionxbox
@evolutionxbox是的,這就是[getCommit](http://www.nodegit.org/api/repository/#getCommit)的用處,但它似乎不適用於改變本地樹只是將它作爲參數傳遞給函數。我的問題是如何更新與本地樹? –
只是一個有用的提示:爲了正確的錯誤處理,您希望返回由'repo.getCommit(...)'鏈給出的承諾。就像現在一樣,例如getCommit錯誤處理程序本身會發生的錯誤將不會處理,並且可能會導致程序崩潰。 – Frxstrem