![](/img/trans.png)
[英]Git Aborting with "git pull origin master --allow-unrelated-histories"
[英]any way to get back local history after `git git filter-repo -> git pull --allow-unrelated-histories`?
我可能發現了一種不可撤銷地刪除有價值的東西的好方法。 有什么方法可以撤消步驟 1-2 嗎?
git filter-repo --path <this big file>--invert-paths --force
git pull origin main --allow-unrelated-histories
git reflog
的 output$ git reflog --all
01eb3b2 (origin/main) refs/remotes/origin/main@{0}: fetch origin: storing head
5ba15dd (HEAD -> main) refs/heads/main@{0}: commit (initial): update before s6, working on laplace alpha coeff
5ba15dd (HEAD -> main) HEAD@{0}: commit (initial): update before s6, working on laplace alpha coeff
正如@torek 在評論中所述,我在上面對 git 的使用破壞了新創建的文件,這些文件的唯一歷史記錄在本地存儲庫中被覆蓋。
因此,OP 中描述的 git 命令序列是不可逆的。
然而,下面提到的故障安全可能是連接到 Visual Studio Code 遠程環境的大量用戶的唯一生命線,他們意識到濫用基本 git 命令的后果為時已晚。
所以事實證明,即使我在遠程開發容器內進行開發, Visual Studio Code 也會在本地緩存自 v.1.66 以來的遠程工作區更改。 我所要做的就是Local History: Find Entry to Restore
以找到通過 OP 中的git filter-repo
命令在遠程文件系統上刪除的文件的更改歷史記錄。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.