代码之家  ›  专栏  ›  技术社区  ›  Christian Vincenzo Traina

GIT:不应用隐藏-指定的修订太多

  •  0
  • Christian Vincenzo Traina  · 技术社区  · 6 年前

    如果解决方案微不足道,我很抱歉,但我不是GIT专家,也没有在网上找到任何东西。

    我藏了一些变化,我很难恢复它们。也许我把 git stash 两次命令,我希望这不会让我失去一切。

    根据 this question official documentation ,我尝试了以下命令:

    git stash pop
    

    我收到:

    src/schema/schema-generator2.js: needs merge
    unable to refresh index
    

    所以我试着:

    git merge
    
    error: Merging is not possible because you have unmerged files
    

    然后我试着:

    git stash apply stash@{0}
    
    unknown option: -encodedCommand
    
    git stash apply
    
    src/schema/schema-generator2.js: needs merge
    
    git stash apply --index
    
    src/schema/schema-generator2.js:需要合并
    
    git stash show -p stash@{0} | git apply -R
    
    git : Too many revisions specified: 'stash@' 'MAA=' 'xml' 'xml'
    In riga:1 car:1
    + git stash show -p stash@{0} | git apply -R
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (Too many revisi...A=' 'xml' 'xml':String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError
    error: unrecognized input
    

    在上面的文本中,我写了代码的消息,并引用了答案。希望一切都清楚。

    我不明白发生了什么,为什么什么都不管用?我能做些什么来取消我的更改?

    1 回复  |  直到 6 年前
        1
  •  0
  •   rajeshnair    6 年前

    看起来问题在于隐藏的更改和您的分支的最新负责人不能自动地进行mergable,特别是在 src/schema/schema-generator2.js 文件

    这意味着您必须手动解决合并冲突

    最好的方法是将隐藏的更改转换为修补程序文件并尝试应用修补程序文件。您仍将看到合并冲突,但可以更好地控制解决更改

    $ git stash show -p --color=never > my-stashed-changes.patch
    # This should show the same merge error
    $ git apply my-stashed-changes.patch
    # modify the patch file to resolve conflicts and apply again