本文介绍了git rerere不会自动提交autoupdated合并解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这个想法是,rerere缓存应该是最新的,当时我们可以使用共享的rerere缓存来自动化一次性整合/测试分支。分支被推,所以这些合并总是通过。但是,它们不会:

 >>> git merge --no-ff invoicing 
使用以前的解决方案对'analysisrequest.py'进行分级。
使用以前的分辨率分级'__init__.py'。
自动合并__init__.py
CONFLICT(内容):合并__init__.py中的冲突
自动合并analysisrequest.py
CONFLICT(内容):在analysisrequest.py中合并冲突
自动合并失败;修复冲突,然后提交结果。

此时,rerere已经提出了它记住的决议,并且没有实际的冲突存在。我可以运行 git commit ,然后继续,但是我的integration-test-build脚本看到一个错误。我已经尝试在git merge命令中添加 --rerere-autoupdate ,但没有任何更改。我已经配置了repo来启用和自动应用rerere匹配。



如何让git merge使用我以前的解决方案并继续而不失败,如果它们足够的话? / p>

解决方案

即使使用 --rerere-autoupdate 标志, git merge 似乎不愿意在没有人工输入的情况下自动完成合并。在这种情况下,它会执行一个错误状态,并且你的集成工具拒绝继续。



我不知道你的自动合并是如何发生的,也就是说,如果你可以改变执行的git命令。如果可以的话,那么你可以执行以下命令。

  git merge --no-ff分支合并 - rerere-autoupdate 
if [[$(git rerere diff)]]
然后
git commit --no-edit
else
$(exit 1)




  • git rerere diff code>列出需要在 rerere
  • 之后解析的文件
  • - no-edit 是防止打开提交消息编辑器所必需的。
  • 如果 rerere 无法干净地合并所有更改该语句仍将以错误状态执行,并且不会提交合并。


    • 提交信息仍然包含冲突文件 除非你想退出你的shell,否则 exit 1 需要放在 $()里面(猜猜我是怎么知道的: - ))


    I'm trying to use the shared rerere cache to automate throwaway integration/test branches.

    The idea is that the rerere cache should be up to date when the branch is pushed, so that these merges always pass. However, they don't:

    >>> git merge --no-ff invoicing
    Staged 'analysisrequest.py' using previous resolution.
    Staged '__init__.py' using previous resolution.
    Auto-merging __init__.py
    CONFLICT (content): Merge conflict in __init__.py
    Auto-merging analysisrequest.py
    CONFLICT (content): Merge conflict in analysisrequest.py
    Automatic merge failed; fix conflicts and then commit the result.
    

    At this point, rerere has staged the resolutions that it remembered, and no actual conflict exists. I can run git commit, then continue, but my integration-test-build script sees an error. I've tried adding --rerere-autoupdate to the git merge command, but nothing changes. I have configured the repo to enable and auto-apply rerere matches.

    How can I ask git merge to use my previous resolutions and continue without failing if they are sufficient?

    解决方案

    Even with the --rerere-autoupdate flag, git merge seems to be reluctant to automatically complete the merge without some human input. This being the case, it executes with an error status, and your integration tool refuses to proceed.

    I do not know how your automatic merging is happening, namely, if you can change the git command that is executed. If you can, then you can execute the following commands.

    git merge --no-ff branch-to-merge --rerere-autoupdate
    if [[ $(git rerere diff) ]]
    then
        git commit --no-edit
    else
        $(exit 1)
    fi
    

    • git rerere diff list files that need to be resolved after rerere
    • --no-edit is necessary to prevent opening the commit message editor
    • In case rerere was not able to cleanly merge all changes this statement will still execute with an error status, and the merge will not be committed.
      • The commit message will still contain the conflicting files
    • exit 1 needs to be inside $() unless you want to exit your shell (guess how I know this :-))

    这篇关于git rerere不会自动提交autoupdated合并解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-10 05:19