反转git存储导致修补程序失败
我做了一件事反转git存储导致修补程序失败,git,git-stash,Git,Git Stash,我做了一件事 git stash 然后 git rebase origin/master 都很成功 然而 git stash apply 我不太高兴: $git stash apply Auto-merging yarn/pom.xml CONFLICT (content): Merge conflict in yarn/pom.xml Auto-merging unsafe/pom.xml CONFLICT (content): Merge conflict in unsafe/pom
git stash
然后
git rebase origin/master
都很成功
然而
git stash apply
我不太高兴:
$git stash apply
Auto-merging yarn/pom.xml
CONFLICT (content): Merge conflict in yarn/pom.xml
Auto-merging unsafe/pom.xml
CONFLICT (content): Merge conflict in unsafe/pom.xml
Auto-merging tools/pom.xml
CONFLICT (content): Merge conflict in tools/pom.xml
Auto-merging streaming/pom.xml
CONFLICT (content): Merge conflict in streaming/pom.xml
Auto-merging sql/hive/pom.xml
CONFLICT (content): Merge conflict in sql/hive/pom.xml
Auto-merging sql/hive-thriftserver/pom.xml
CONFLICT (content): Merge conflict in sql/hive-thriftserver/pom.xml
..
恢复apply
的一致方法似乎是:
$git stash show -p | git apply -R
然而,这导致:
error: patch failed: assembly/pom.xml:20
error: assembly/pom.xml: patch does not apply
error: patch failed: bagel/pom.xml:20
error: bagel/pom.xml: patch does not apply
error: patch failed: core/pom.xml:20
error: core/pom.xml: patch does not apply
error: patch failed: examples/pom.xml:20
error: examples/pom.xml: patch does not apply
error: patch failed: external/flume-assembly/pom.xml:20
.. and so on ..
那么,有没有办法将整个
stash apply
回滚?恢复隐藏的更改失败的原因与应用隐藏的更改失败的原因相同:基础内容更改太多,因此补丁不太适合
如果您只想将所有文件还原为HEAD
的内容,则只需:
git reset --hard
从手册中:
git reset [<mode>] [<commit>]
This form resets the current branch head to <commit> and possibly
updates the index (resetting it to the tree of <commit>) and the
working tree depending on <mode>. If <mode> is omitted, defaults to
"--mixed". The <mode> must be one of the following:
--hard
Resets the index and working tree. Any changes to tracked files
in the working tree since <commit> are discarded.
git重置[]
此表单将当前分支标头重置为,并且可能
更新索引(将其重置为目录树)和
工作树取决于。如果省略,则默认为
“--混合”。必须是以下内容之一:
--硬的
重置索引和工作树。对跟踪文件的任何更改
在工作树中,因为已丢弃。
是的,注意到git重置(并将其作为一种解决方法)。。但我想更好地理解git隐藏还原中的错误/损坏之处。与应用隐藏更改时遇到的问题相同:基础内容更改太多,因此修补程序不太合适。实际上,您的评论对于您答案的有用性很重要。建议你更新你的答案。好吧,你没有问为什么apply-R
失败当然,我可以把它放在那里。