问题
I have some local files that all developers have to change. I marked the files as "assume unchanged" but that doesn't keep them from changing when doing a reset. Is there a hook on git that's executed after git reset?
If not, does anybody have a suggestion on how to handle this situation?
回答1:
You can find a list of Git hooks here:
- applypatch-msg
- pre-applypatch
- post-applypatch
- pre-commit
- prepare-commit-msg
- commit-msg
- post-commit
- pre-rebase
- post-checkout
- post-merge
- pre-receive
- update
- post-receive
- post-update
- pre-auto-gc
- post-rewrite
There is no post-reset
hook among them.
回答2:
In case it help, post-checkout seems to be triggered after a reset.
The 3rd param of that trigger would probably allow you to do what you want.
E.g.:
#!/bin/sh
if [ "$3" -eq "0" ]
then
echo "$3 indicates whether the checkout was a branch checkout (changing branches, flag=1) or a file checkout (retrieving a file from the index, flag=0)"
fi
来源:https://stackoverflow.com/questions/18645512/is-there-a-hook-on-git-for-post-reset