如何反向申请与冲突存储?
我已经看到了如何反向应用存储的问题? Pat Notz问道。 我已经尝试了批准的答案,但是我得到了这样的错误,
sudo git stash show -p | git apply --reverse
error: patch failed: app/controllers/CloudController.php:673
error: app/controllers/CloudController.php: patch does not apply
error: patch failed: app/controllers/CloudGcode.php:1
error: app/controllers/CloudGcode.php: patch does not apply
我必须解释我在这种情况下如何运行。 我在我的存储列表中有一个存储,并且在我的工作存储库中做了一些修改。 我的工作存储库中的更改与存储@ {0}发生冲突。 然后我执行git add .
和sudo git stash apply
错误的命令,它显示这个信息,
sudo git stash apply
[sudo] password for xxxx:
Auto-merging app/controllers/CloudGcode.php
CONFLICT (add/add): Merge conflict in app/controllers/CloudGcode.php
Auto-merging app/controllers/CloudController.php
CONFLICT (content): Merge conflict in app/controllers/CloudController.php
隐藏应用之后,我的文件中会有这样的冲突,
<<<<<<< Updated upstream
for($i = 0; $i < $textlen; $i++)
{
$char = $uchars[$index++];
if($char !== 0)
$text = $text.chr($char);
}
$this->text = $text;
Log::info('LLLLLLLLLLLLLLLLLLLL'.$text);
=======
for($i = 0; $i < $this->textlen; $i++)
$text = $text.$uchars[$index++];
$this->text = $text;
$this->text[$this->textlen] = 0; // Terminate string overwriting checksum
>>>>>>> Stashed changes
$this->waitUntilAllCommandsAreParsed = true; // Don't destroy string until executed
}
$this->formatErrors = 0;
return true;
}
<<<<<<< Updated upstream
=======
然后我谷歌如何恢复它。 我进来的问题如何反向申请藏匿? Pat Notz问道,并尝试解决这个问题。 我想知道有没有办法在执行sudo git stash apply
之前回滚状态,在执行git add .
之后或之后执行git add .
你应该简单地重新存储,然后git重置(或者甚至是git reset --hard
,如果你先存储的话),如“中止git stash apply
”中所述。
如果你reset --hard
没有先存储,你仍然可以在.git/refs/stash
看到你的补丁,如“撤消git reset --hard
在git stash pop
后git stash pop
”(通过git stash apply
不会删除无论如何,这个补丁就像git stash pop
一样,所以在这里你不必担心),或者你可以从git fsck
恢复它。
我想在执行sudo git stash apply
之前回滚状态
因为git apply --reverse
不起作用,所以最好按照我上面的建议回到HEAD, git apply --reverse
做你的操作。
上一篇: How to reverse apply a stash that with conflict?
下一篇: How to recover files added to git but overwritten by checkout