Skip to content

Instantly share code, notes, and snippets.

@eduardo-matos
Last active December 10, 2015 14:58
Show Gist options
  • Save eduardo-matos/4451501 to your computer and use it in GitHub Desktop.
Save eduardo-matos/4451501 to your computer and use it in GitHub Desktop.
Verificar se existe conflito antes do commit (GIT)
#!/bin/sh
conflitos=`git diff --staged --pretty="format:" --name-only -S"<<<<<<< HEAD"`;
if [[ $conflitos != '' ]]; then
echo "";
echo "";
echo "Existem conflitos a serem resolvidos nos seguintes arquivos:";
# texto preto, background vermelho
echo -e "\E[30;41m";
echo $conflitos;
# texto branco, background preto (padrão)
echo -e "\E[37;40m";
echo "Resolva-os e tente comitar novamente.";
exit -1;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment