Skip to content

Instantly share code, notes, and snippets.

@Deco
Last active August 29, 2015 13:57
Show Gist options
  • Save Deco/9487472 to your computer and use it in GitHub Desktop.
Save Deco/9487472 to your computer and use it in GitHub Desktop.
Git warning on requirements.txt change (save as ".git/hooks/post-merge" and run "chmod +x .git/hooks/post-merge")
#!/bin/bash
set -eu
git diff "HEAD@{1}" --name-only | grep requirements.txt 2>&1 > /dev/null
CHANGED=$?
if [ $CHANGED ]; then
echo
echo -e "\e[41m!!! requirements.txt HAS CHANGED !!!\033[0m"
echo
echo "Run this now:"
echo " pip install -r requirements.txt"
fi
# source: http://blog.daniel-watkins.co.uk/2013/01/git-tip-get-warning-when-file-has.html
#!/bin/bash
set -eu
git diff "HEAD@{1}" --name-only | grep requirements.txt 2>&1 > /dev/null
CHANGED=$?
if [ $CHANGED ]; then
echo
echo -e "\e[41m!!! requirements.txt HAS CHANGED !!!\033[0m"
echo
echo "Executing \"pip install -r requirements.txt\":"
pip install -r requirements.txt
fi
# source: http://blog.daniel-watkins.co.uk/2013/01/git-tip-get-warning-when-file-has.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment