Git hook for any action that updates the working directory
问题 Following an answer to a previous question, I implemented a Git hook script which needs to fire whenever the working directory is updated. I linked this script to the following in .git/hooks: post-checkout post-commit post-merge This mostly works, but not always. One case I found is git stash . This is a problem because my hook generates a text file wihch I also mark with git update-index --assume-unchanged to tell Git that I don't want to check in changes (an empty version is checked in).