Created
November 30, 2011 21:43
-
-
Save thinkt4nk/1411055 to your computer and use it in GitHub Desktop.
git hook for resetting files before commit
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/python | |
import os | |
import sys | |
ignore_paths = ['apps/ppc/templates/_scripts.php'] | |
# chdir to project root | |
os.chdir(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..','..')) | |
# for each path, reset and re-checkout before commit | |
for path in ignore_paths: | |
ignore_file = os.path.join(os.getcwd(),path) | |
print 'resetting file: %s' % ignore_file | |
if os.path.isfile(ignore_file): | |
print os.system('git reset %s' % path) | |
print os.system('git checkout %s' % path) | |
exit(0) # return zero status to continue commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment