thinkt4nk
11/30/2011 - 9:43 PM

git hook for resetting files before commit

git hook for resetting files before commit

#!/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