Git resolve conflict using --ours/--theirs for all files

前端 未结 6 661

Is there a way to resolve conflict for all files using checkout --ours and --theirs? I know that you can do it for individual files but couldn\'t f

6条回答
  •  -上瘾入骨i
    2020-12-22 17:40

    function gitcheckoutall() {
        git diff --name-only --diff-filter=U | sed 's/^/"/;s/$/"/' | xargs git checkout --$1
    }
    

    I've added this function in .zshrc file.

    Use them this way: gitcheckoutall theirs or gitcheckoutall ours

提交回复
热议问题