是否有任何用于拉动的 git 钩子?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4185400/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there any git hook for pull?
提问by msgre
I need to perform some actions (prepare gettext *.mo message files) on my project everytime I run git pull
. Is there any suitable git hook, which I could use for this purpose please?
每次运行git pull
. 是否有任何合适的 git hook,我可以用于此目的?
回答by Cascabel
The githooks
man page is a complete list of hooks. If it's not on there, it doesn't exist.
该githooks
手册页是挂钩的完整列表。如果它不在那里,它就不存在。
That said, there isa post-merge hook, and all pulls include a merge, though not all merges are pulls. It's run after merges, and can't affect the outcome. It never gets executed if there were conflicts; you'd have to pick that up with the post-commit hook if it really matters, or invoke it manually.
这就是说,有是一个后合并挂钩,所有的拉包括合并,虽然不是所有的合并是拉。它在合并后运行,不会影响结果。如果有冲突,它永远不会被执行;如果真的很重要,您必须使用 post-commit 钩子选择它,或者手动调用它。
回答by Snowcrash
post-merge
- see https://git-scm.com/docs/githooks#_post_mergefor more details of how to use it.
post-merge
-有关如何使用它的更多详细信息,请参阅https://git-scm.com/docs/githooks#_post_merge。