我想还原最近从一年前克隆回其自身以前版本的公共存储库。我不想硬还原。
我已经尝试过:
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>'
我是这个新手;可以使用什么代码安全地执行此操作?预先感谢。
答案 0 :(得分:0)
(已编辑)(感谢@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"