git rerere does not auto-commit autoupdated merge resolutions

后端 未结 1 1756
甜味超标
甜味超标 2020-12-14 03:26

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

1条回答
  •  一整个雨季
    2020-12-14 04:09

    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 :-))

    0 讨论(0)
提交回复
热议问题