【发布时间】:2015-06-22 11:36:53
【问题描述】:
我在 public/uploads/ 目录中有很多文件。在提交之前,我输入了git rm -- public/uploads/*,然后是git commit -a -m "upload",然后是git push origin master。
在以前的提交照片中不存在。现在我想将它们从 git 恢复到服务器。我该怎么做?
【问题讨论】:
我在 public/uploads/ 目录中有很多文件。在提交之前,我输入了git rm -- public/uploads/*,然后是git commit -a -m "upload",然后是git push origin master。
在以前的提交照片中不存在。现在我想将它们从 git 恢复到服务器。我该怎么做?
【问题讨论】:
如果它们从未被添加或提交,您将无法恢复它们。
假设您删除它们的提交的哈希是 abc123。如果您想撤消整个提交,只需执行git revert abc123。如果您想保留提交的其他部分,请执行以下操作:
git revert abc123 --no-commit
git reset
git add public/uploads/
git commit
然后文件将回到存储库中。
【讨论】:
deleted 的形式加载