#! /bin/bash fis="" for fi in $(git status|sed -n 's/^ both modified: *//p');do if ! grep -q '^<<<<<<< ' $fi;then git add $fi continue fi fis="$fis $fi" done if [ -z "$fis" ];then echo done exit 0 fi set -x exec vim $fis