Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 为什么合并会覆盖对以下文件的本地更改?_Git_Git Stash - Fatal编程技术网

Git 为什么合并会覆盖对以下文件的本地更改?

Git 为什么合并会覆盖对以下文件的本地更改?,git,git-stash,Git,Git Stash,我在不同的地方更改了Makefile 为什么我仍然出错? $ git stash pop error: Your local changes to the following files would be overwritten by merge: Makefile Please commit your changes or stash them before you merge. Aborting The stash entry is kept in case you need i

我在不同的地方更改了
Makefile

为什么我仍然出错?

$ git stash pop
error: Your local changes to the following files would be overwritten by merge:
    Makefile
Please commit your changes or stash them before you merge.
Aborting
The stash entry is kept in case you need it again.

我的更改不相交。因此,我希望它们可以毫无问题地合并。

存在一些技术问题,这些问题阻碍了
git stash pop
像其他命令一样自由地使用索引(因为它实际上修改了索引本身),并避免了
stash apply
机制的复杂逻辑,
git stash pop
只是拒绝对“不干净”的文件应用更改


解决此问题的简单方法是使用所述文件创建提交:

git add Makefile
git commit -m "wip"
git stash pop

# ... fix stuff if needed ...

# after stash application : you can jump one commit backwards
git reset --soft HEAD^   # if you want to keep stuff in the index
git reset HEAD^          # if you can reset the index too

有一些技术问题阻碍了
git stash pop
像其他命令一样自由地使用索引(因为它实际上修改了索引本身),并且为了避免
stash apply
机制周围的复杂逻辑,到目前为止,
git stash pop
只是拒绝对“不干净”的文件应用更改


解决此问题的简单方法是使用所述文件创建提交:

git add Makefile
git commit -m "wip"
git stash pop

# ... fix stuff if needed ...

# after stash application : you can jump one commit backwards
git reset --soft HEAD^   # if you want to keep stuff in the index
git reset HEAD^          # if you can reset the index too

您需要进行本地更改。发布您可以尝试git stash pop,git将尝试自动合并。@Prasanna:我从错误消息中知道该怎么做。但是为什么我要这么做呢?你需要进行你当地的改变。发布您可以尝试git stash pop,git将尝试自动合并。@Prasanna:我从错误消息中知道该怎么做。但是为什么我要这么做呢?如果有
autostash
选项就好了。就像在A中隐藏以允许应用隐藏B不是真正的解决方案一样,IMHO…:):)如果有
autostash
选项就好了。就像在A中隐藏以允许应用隐藏B不是真正的解决方案一样,IMHO…:):)