在 `git rebase` 期间自动化 `--ours` 和 `--theirs`

霸王金龙

我有一个 500-commit 的 long rebase,我必须为它指定相同的文件以支持通过github checkout --ours file.py--theirs每次提交;有没有办法通过告诉 git bash 将此首选项应用于所有进一步的冲突来自动执行此操作?

efshift0

如果这是一个轻率的过程,那么请随意编写一个脚本......类似于:

git rebase blahblahblah
if [ $? -ne 0 ]; then
    # rebase stopped for whatever reason
    while true; do
        git checkout --ours blahblah
        # more commands to specify what should be attempted with each file
        git add . # add all files.... perhaps something a little mlre specific would help
        # let's try again
        GIT_EDITOR=/bin/true git rebase --continue
        if [ $? -eq 0 ]; then
            break # we are done
        fi
    done
fi

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章