Git Hooks: GIT_DIR and changing directories

If you’re doing something that needs to change its directory to another place (like say, you have the unfortunate need to call an external repository to perform a subtree merge after your repository has been updated), the variable GIT_DIR needs to be unset for things to work properly.

Do:
unset GIT_DIR
in your bash script to make this happen.

References:
http://www.kernel.org/pub/software/scm/git/docs/howto/rebuild-from-update-hook.txt

Advertisements