删除交换文件时git stash pop失败

时间:2011-11-30 05:57:31

标签: git

我删除了一个交换文件并在发出拉取请求之前调用了git stash。当我尝试git stash pop时,我收到了以下错误

  

无法申请肮脏的工作树,请进行更改

我按照此wiki尝试通过修补修改来应用。但它没有用。

我想这条消息会给出一些提示

diff --git a/db/.schema.rb.swp b/db/.schema.rb.swp
deleted file mode 100644
index 6570b8e..0000000
Binary files a/db/.schema.rb.swp and /dev/null differ

如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

不应该将交换文件提交到git存储库中。请尝试按照说明操作:

git rm db/.schema.rb.swp   # Delete the swap file from git repository
echo "*.swp" >> .gitignore # Ignore swap files
git add .gitignore
git commit                 # Commit the deletion & changes
git status                 # Make sure that you have no uncommited changes
git stash apply            # Then apply the stash