
事件顺序
git rm --cached A 并把 A 添加到 gitignore -- commit10git rebase -i commit2. 保持 commit10 不变复现步骤总结错了.
实际上是
git rm A # and ignore A -- commit10 mv /some/other/file A 这个A没有备份的话, 应该真的找不回来.
2 momocraft 2021-04-13 14:32:56 +08:00 commit10 删掉了 A, apply 时也删掉 A 不是正常的吗? 你的期待是 apply 后 A 留在 worktree? 可是 commit 一级不保留这个信息 |
3 xuanbg 2021-04-13 14:42:23 +08:00 签出 commit9 不就回来了? |
4 hw93 2021-04-13 15:57:07 +08:00 只要 commit 了,文件就不会丢 |
6 dezng 2021-04-13 16:21:38 +08:00 看你上面的操作,rebase 基于 commit2,commit1 还存在,A 文件肯定还在。即使 commit1 没了,一般通过 git reflog 也能找回。 |