I'm writing a post-checkout hook, but I'd like to avoid it being run if certain conditions are met, with one of these being upon checkout of a single touched file. For example, I'd like it to run if I run git checkout somebranch
, but avoid it being run if I just want to git checkout -- some/touched/file
.
As far as I know, the post-checkout
script is only passed the previous and post-checked-out commit hashes, with some additional data being scrapable from the git repo's global state, but I'm not sure what to check to figure out if it's just a single file being checked out.
Is this possible at all? If so how?