相关疑难解决方法(0)

Git stash:"不能申请肮脏的工作树,请进行更改"

我正在尝试应用我之前隐藏的更改git stash pop并获取消息:

Cannot apply to a dirty working tree, please stage your changes
Run Code Online (Sandbox Code Playgroud)

关于如何处理的任何建议?

git git-stash

132
推荐指数
5
解决办法
5万
查看次数

如何在git中组合多个stas

这是frontend过去两周内分行的管道.

| Stash@{3}是所有代码Stash@{1}(不包括两个微小的提交)
| 微小的承诺
| 微小的提交
| 两周前巨大的批量提交,现在已经重新定位并转移到了Stash@{1}

我的工作树目前很干净.
Stash@{1}是两周前一般开发代码的批量提交的内容(这应该首先被隐藏).这个提交被撤消并转移到藏匿处.
Stash@{3}是自那以后的最新工作Stash@{1}(减去已经提交的几个更改).

我需要在我的工作树中将这两个存储块组合在一起,这样我就可以从这个巨大的工作池中做出一些提交.

我跑了git stash apply stash@{1}然后我试过:

git stash apply stash@{3}
git stash show -p | git stash apply stash@{3}

但在这两种情况下我都得到了"肮脏的工作树".我如何将这项工作合并在一起?因为stash@{3}更新,我希望它在stash@{1}任何有冲突的地方取代.

git git-stash

58
推荐指数
4
解决办法
2万
查看次数

无法弹出git stash,'您对以下文件的本地更改将被合并覆盖'

所以我有一大堆更改和一些未跟踪的文件.我需要调整一些东西,所以我使用git stash -u,修改了一些东西,提交了这些修改,推动了它们,然后尝试了git stash pop.

因为我修改了一些我藏匿的文件,所以收到了以下消息:

error: Your local changes to the following files would be overwritten by merge:
    file_1.py
    file_2.py
Please, commit your changes or stash them before you can merge.
Aborting
Run Code Online (Sandbox Code Playgroud)

这看起来很奇怪,我已经提交了所有新的更改,当我运行命令时,我的结账很干净.

似乎git stash pop操作没有隐藏我的一半更改和未跟踪的文件,但如果我git stash pop再次尝试,我得到的输出如下:

some_file.html already exists, no checkout
some_other_file.html already exists, no checkout
yet_another_file.html already exists, no checkout
Could not restore untracked files from stash
Run Code Online (Sandbox Code Playgroud)

git stash show 仍然显示了我的藏匿变化列表,但我对我现在所做的事情感到茫然.

我怎么能让自己脱身?

git git-stash

53
推荐指数
2
解决办法
3万
查看次数

标签 统计

git ×3

git-stash ×3