Git Tower 无法重新应用存储:索引冲突

Git Tower fails to reapply stash: Conflicts in index

在 Git 塔内,我藏有大约 26 个文件。但是,当我尝试将存储应用回我的工作树时,我收到有关尾随空格的错误。

我怎样才能成功应用存储,绕过这个错误?

完整的错误信息如下:

<stdin>:87: trailing whitespace.
       // query code
      <stdin>:88: trailing whitespace.
      // query code
      <stdin>:104: trailing whitespace.
        // query code   
      <stdin>:118: trailing whitespace.
        // query code
       <stdin>:119: trailing whitespace.
            //error code
error: patch failed: app/Http/Controllers/ProjectController.php:43
error: app/Http/Controllers/ProjectController.php: patch does not apply 
error: patch failed: resources/views/projects/filter.blade.php:1
error: resources/views/projects/filter.blade.php: patch does not apply
Conflicts in index. Try without --index.

Conflicts in index. Try without --index.

这意味着您尝试 git stash apply --index 并且在 Git 尝试应用隐藏补丁时发生了冲突。当Git遇到冲突时,将冲突状态存储在索引中,以防止您不小心提交未解决的冲突并提醒您首先实际解决那些冲突。因此,当 Git 需要这些冲突的索引时,显式恢复隐藏的索引状态将失败。

这个也有解释in the documentation:

If the --index option is used, then tries to reinstate not only the working tree’s changes, but also the index’s ones. However, this can fail, when you have conflicts (which are stored in the index, where you therefore can no longer apply the changes as they were originally).

因此,如错误消息所示,解决方案是使用不带 --index 的命令。

如果 Git Tower 自动为您执行此操作,那么您可能需要从此处的命令行恢复存储。

要添加到 from poke :在 Tower 中,您必须 停用 选项“恢复暂存区状态”以在没有 --index 的情况下应用存储.