![](/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.