Created
October 2, 2017 01:19
-
-
Save nnja/5ce68f0312caf6607bba15dde2c28f02 to your computer and use it in GitHub Desktop.
Git Hook: Example post-merge hook that checks for updates to requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import subprocess | |
diff_requirements = 'git diff ORIG_HEAD HEAD --exit-code -- requirements.txt' | |
exit_code = subprocess.call(diff_requirements.split()) | |
if exit_code == 1: | |
print 'The requirements file has changed! Remember to install new dependencies.' | |
else: | |
print 'No new dependencies.' |
@mojtabasalehiyan if by some chance you are still looking for a possible answer, then maybe creating a bash scripts that activates your virtual environments and then creates migration could solve your problem.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would like to run some commands after git pull for django project.
as you know, developers use virtual environment for developing django projects. So I should use the python used in project virtual environment.
how to handle this?
I want to run
python manage.py migrate
andpip install requirements.txt
after git pull.thanks.