Skip to content

Instantly share code, notes, and snippets.

@vincode-io
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
#!/bin/sh
#
# Add this to your .git/hooks/pre-commit file to detect unresolved merge conflict markers
#
CHECK=$(git diff --staged --check)
if [ ! -z "$CHECK" ]
then
echo "$(tput setab 1) WARNING $(tput sgr0) Conflict markers still present"
echo "-------------------------------------------------"
echo "$CHECK"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment