丢失更改,因为Git隐藏流行消息无法完成

问题描述

我在本地存储库中保存了更改,因为我需要提取和同步我的代码库。 Stashing抱怨其中一个文件数据库)已打开。我将打开的文件还原为原始状态。因此,我的储藏室变得凌乱,现在没有弹出。隐藏在存储库中的很多重要更改都没有消失。

以下是“ git stash list”的输出

    stash@{0}: WIP on master: f6e6d35 - Added Cabinet Raspi app initial version - Improved Muxboard module - Added NFC sample python module with support material

以下是“ git stash pop”的输出

error: Your local changes to the following files would be overwritten by merge:
        website/nokienv/Lib/site-packages/pip/__init__.py
        website/nokienv/Lib/site-packages/pip/__main__.py
        website/nokienv/Lib/site-packages/pip/_internal/__init__.py
        website/nokienv/Lib/site-packages/pip/_internal/build_env.py
        website/nokienv/Lib/site-packages/pip/_vendor/ipaddress.py
        website/nokienv/Lib/site-packages/pip/_vendor/packaging/__about__.py
        w
Aborting

隐藏条目会保留,以防您再次需要。

Index was not unstashed.

使用命令'git stash pop --index 0'会得到相同的输出,并显示一条额外的消息:

有人可以帮我找回我在储藏室中丢失的更改吗?任何帮助将不胜感激。

解决方法

由于存在集合,您需要先在npm run start之前清理工作目录。这是三种解决方案:

  1. 通过git stash pop放弃本地更改。 (危险:当前更改将丢失)

  2. 先存储本地更改,然后弹出上一个更改:

git reset --hard
  1. 提交本地更改,然后隐藏弹出窗口并解决冲突:
    git stash 

    git stash pop stash@{1}

然后会出现一些冲突,并由您自己来解决。