I have a prepush hook that tests my code, however, it also runs when I do a git push --tags. Is there any way to avoid this?
Maybe there's some way to check if its a regular push or if its a --tags push?
Update - These are the only arguments I was able to find:
- $1 is the name of the remote
- $2 is url to which the push is being done
I have a solution to this, but it's really kludgey. A while back, I set up a pre-commit hook to stop me from accidentally using
-awhen I have files staged. My solution is to read the command that invoked the original git command (probably only works on linux too).Original
That being said, try calling
envin the hook; git sets a few extra vars (starting withGIT_prefixes, likeGIT_INDEX_FILE).