Skip to content

Instantly share code, notes, and snippets.

Last active September 29, 2023 21:28
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save vincode-io/48f3394f379bac2351127dbe630f2233 to your computer and use it in GitHub Desktop.
Detect unresolved merge conflict markers using a Git pre-commit hook
# Add this to your .git/hooks/pre-commit file to detect unresolved merge conflict markers
CHECK=$(git diff --staged --check)
if [ ! -z "$CHECK" ]
echo "$(tput setab 1) WARNING $(tput sgr0) Conflict markers still present"
echo "-------------------------------------------------"
echo "$CHECK"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment