[英]How to Revert Public Git Repo to Specific Previous Commit?
我想恢復一個公共回購,我最近克隆回一年前的自己的先前版本。 我不想做一個很難恢復。
我已經嘗試過了:
cd MyRepo
git revert --no-commit dc3b4359..
但我得到了這個錯誤:
error: could not revert dc3b4359...
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
我是新手; 什么代碼可以用來安全地做到這一點? 提前致謝。
(已編輯) (謝謝@torek)
最粗糙的方式是:
cd MyRepo
git rm -r .
git checkout dc3b4359 -- .
git add .
git commit -m "Going back in time"
git push origin master
原始答案:
cd MyRepo
rm -rf * # if you have files starting with '.', delete them too.
git checkout dc3b4359 -- .
git add .
git commit -m "Going back in time"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.