Skip to content

Instantly share code, notes, and snippets.

@yoichi
Last active May 2, 2020 07:51
Show Gist options
  • Save yoichi/056fbf49eb0a9c2cbc743a1642c62c42 to your computer and use it in GitHub Desktop.
Save yoichi/056fbf49eb0a9c2cbc743a1642c62c42 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# usage:
# git-list-conflicts.sh
# git-list-conflicts.sh branch-name
# git-list-conflicts.sh revison-begin..revision-end
git log --merges --pretty=tformat:%H $@ | while read COMMIT ; do
PARENTS=$(git log -1 --pretty=tformat:%P ${COMMIT})
git checkout ${COMMIT}~1 2>/dev/null
git merge --no-commit $(echo ${PARENTS} | cut -f 2- -d" ") >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo ${COMMIT}
fi
git reset --hard >/dev/null
git checkout - >/dev/null 2>&1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment