![](/img/trans.png)
[英]how to recover an accidently deleted remote git repository from local repository
[英]git: remove files of the remote repository that are been deleted in the local repository
远程存储库(bitbucket)中存在一些文件。 但是,这些文件在本地存储库中不再存在。
我猜它与以下命令有关:
git config core.ignorecase false
在意识到文件在我的计算机(OSX)中是正确的但在Git存储库中是错误的之后,我执行了该命令(它们在本地存储库中为小写,而在远程存储库中为大写)。 然后我执行了:
git add . && git commit -m "comment"
git push origin master
不幸的是,存储库的大写文件没有更改为小写。 相反,存储库保留了大小写文件的重复。
我已经执行了以下命令:
git diff master origin (it does not show anything, I guess because it does not detect any change).
git commit -a (no effect)
git add -u (no effect)
从远程更新本地存储库,删除大写的文件(假设要在远程存储库中保留小写的文件),从工作树和索引中删除文件,提交并推送到远程,如下所示:
git pull origin <remote> --rebase
rm <file-with-upper-case> //skip if file does not exist in local
git rm -f <file-with-upper-case>
git commit -m "Deleted Upper Case File"
git push origin <remote>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.