[英]any way to get back local history after `git git filter-repo -> git pull --allow-unrelated-histories`?
I may have discovered a great way to irrevocably delete valuable stuff.我可能发现了一种不可撤销地删除有价值的东西的好方法。 Is there any way I can undo steps 1-2?
有什么方法可以撤消步骤 1-2 吗?
git filter-repo --path <this big file>--invert-paths --force
git pull origin main --allow-unrelated-histories
git reflog
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
<changed file> (Explorer View)->Open Timeline
.<changed file> (Explorer View)->Open Timeline
Visual Studio Code 中未提交更改的历史记录。 As stated by @torek in the comments, my usage of git above destroyed the newly-created files whose only history was overwritten in the local repo.正如@torek 在评论中所述,我在上面对 git 的使用破坏了新创建的文件,这些文件的唯一历史记录在本地存储库中被覆盖。
Therefore, the sequence of git commands described in the OP are irreversible.因此,OP 中描述的 git 命令序列是不可逆的。
However, the fail-safe noted below may represent the only lifeline for the huge number of users connecting to remote environments in Visual Studio Code, who realize too late the consequences of abusing basic git commands.然而,下面提到的故障安全可能是连接到 Visual Studio Code 远程环境的大量用户的唯一生命线,他们意识到滥用基本 git 命令的后果为时已晚。
So it turns out that even though I was developing inside a remote dev container, Visual Studio Code locally caches remote workspace changes since v.1.66 .所以事实证明,即使我在远程开发容器内进行开发, Visual Studio Code 也会在本地缓存自 v.1.66 以来的远程工作区更改。 All I had to do was
Local History: Find Entry to Restore
to locate the change history for files which were deleted on remote file system by the git filter-repo
command in the OP.我所要做的就是
Local History: Find Entry to Restore
以找到通过 OP 中的git filter-repo
命令在远程文件系统上删除的文件的更改历史记录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.