用git stash丢失的变化,无法还原

问题描述 投票:2回答:1

我在工作分支上做了一堆修改,然后是git stash。我不知道这是否正常,但我在终端收到了一些奇怪的警告:

C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 17: git-sh-setup: No such file or director
y
C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 18: git-sh-i18n: No such file or directory

C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 19: require_work_tree: command not found
C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 20: cd_to_toplevel: command not found
C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 186: /logs/refs/stash: No such file or dir
ectory
C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 267: say: command not found
HEAD is now at 73b4e15 bug in resend email

我创建了一个新分支,想要应用隐藏的更改git checkout -b new_branch; git stash apply。这给了我:

C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 17: git-sh-setup: No such file or director
y
C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 18: git-sh-i18n: No such file or directory

C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 19: require_work_tree: command not found
C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 20: cd_to_toplevel: command not found
C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 396: eval_gettext: command not found
C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 396: die: command not found
C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 424: eval_gettext: command not found
C:\Program Files (x86)\Freeware\Git\1.9.5/libexec/git-core\git-stash: line 424: die: command not found
usage: git merge-recursive <base>... -- <head> <remote> ...

没有改变......我不能在藏匿之前回来。我当然搞砸了,但在藏匿和结帐之前,有没有办法在第一个分支上恢复损失?

git
1个回答
0
投票

您的配置存在一些问题,因此git-stash脚本无法找到其工作所依赖的其他脚本。因此,我们很难知道剩下的状态是什么。

我真的不想猜,但我会说我很悲观。我很惊讶脚本远远不足以修改你的工作目录或索引,但从你所描述的内容听起来就像它那样;并且根本不清楚事情是否已正确写入数据库。但同样,这是99%的猜测。

所以工作一是找出剧本起作用的原因。你有正确安装的git吗?对于其他操作,我认为它一直在工作吗?如果在Windows上,你还记得启动一个启用git的shell实例(“git bash”,“git cmd”等)吗?您是否必须首先执行任何异常操作(例如复制二进制文件或提供完整路径)来调用git?

我有太多的变量可以指导您完成每个意外事件,但我会从这些问题开始,因为您从git-stash获得的错误消息(而非警告)并不正常。

一旦你想出来,下一个工作是评估损害,看看它是否可以恢复。您可以使用git status来确认索引中是否还有任何内容。您可以使用git reflog stash来查看是否在所有混乱中创建了一个新的存储提交。

© www.soinside.com 2019 - 2024. All rights reserved.