无法将存储应用于工作目录 [英] Cannot apply stash to working directory

查看:129
本文介绍了无法将存储应用于工作目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法将存储空间应用到工作目录中。



小故事

首先,我尝试推送一些提交的更改,但它说:不,先不要,先拉......好吧,我将从github中提取所有内容,然后推送我的更改。当我试图拉扯时,它说我的变化已经过时了,而且我应该隐藏自己的变化。好吧,我藏起了变化......做了拉动,并推动提交的变化。但现在,我无法恢复正在处理的未被改变的更改。



这是错误:
$ b

  MyPath / File.cs已经存在,没有结账
无法从存储中恢复未跟踪的文件

当然,我还不了解git的所有概念,他们会让我困惑一些......也许我做错了什么。



如果有人能帮我解决这个问题,那将是非常棒的......我一直在搜索谷歌和所有内容,现在已经超过一个小时了,而且我还没有找到解决方案。 p>

非常感谢帮助。谢谢!

解决方案

听起来像你的存储包含一个未跟踪的文件,随后被添加到回购。当你尝试检查它时,git会正确拒绝,因为它会覆盖现有的文件。



要解决问题,你可以做一些类似于删除该文件的东西(没关系,它仍然在回购),应用你的存储,然后用in-repo版本替换文件的存储版本。

编辑:这个文件也可能只在没有的工作树中被创建,已经被添加到了repo中。在这种情况下,请不要简单地删除本地文件,而是:


  1. 将其移动到其他位置

  2. 应用存储

  3. 手动合并两个文件版本(工作树与移动)。


I cannot apply stash back to the working directory.

Little story:

First I tried to push some commited changes, but it said: "no you can't, pull first"... ok then, I'll pull things from github and then push my changes. When I tried to pull, it said the I had changes that would be ovewritten, and that I should stash my changes. Ok, I stashed changes... did the pull, and push the commited changes. But now, I cannot restore the uncommited changes I was working on.

This is the error:

MyPath/File.cs already exists, no checkout
Could not restore untracked files from stash

For sure I don't yet understand all the concepts of git, they confuse me a bit... maybe I did something wrong.

It would be great if someone could help me solve this... I've been searching google and everything for more than an hour now, and I didn't come to a solution yet.

Help is much appreciated. Thanks!

解决方案

It sounds like your stash included an untracked file that was subsequently added to the repo. When you try and check it out, git rightly refuses because it would be overwriting an existing file.

To fix, you could do something like deleting that file (it's okay, it's still in the repo), applying your stash, and then replacing the stashed version of the file with the in-repo version as appropriate.

Edit: It's also possible that the file has only been created in the working tree without having been added to the repo. In this case, don't simply delete the local file, rather:

  1. move it somewhere else
  2. apply the stash
  3. manually merge the two file versions (working tree vs. moved).

这篇关于无法将存储应用于工作目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆