在pull --rebase之后执行git-hook [英] Executing a git-hook after pull --rebase
问题描述
我想在执行git pull --rebase
之后运行钩子,以检查某个文件是否已更改.类似于此钩子.
I'd like to have a hook run after doing git pull --rebase
in order to check if a certain file was changed. Something along the lines of this hook.
我最初想到使用post-rewrite
钩子,但是它仅在重写提交时才起作用,而当pull
操作只是快进分支时却不运行,这种情况经常发生.
I initially thought of using the post-rewrite
hook, however that only works when commits are being rewritten, and won't run when the pull
operation simply fast-forwards the branch, which is very often.
任何想法都会受到赞赏.
Any ideas will be appreciated.
推荐答案
我在本地存储库中运行了strace git pull --rebase
,该存储库执行了快速更新...
I ran strace git pull --rebase
on a local repository, which performed a fast-forward update...
First, rewinding head to replay your work on top of it...
Fast-forwarded master to b0a60c3302973ca1878d149d61f2f612c8f27fac.
...,在这种情况下,似乎git
调用了post-checkout
钩子:
...and it looks as if git
calls the post-checkout
hook in this case:
这篇关于在pull --rebase之后执行git-hook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!