git post-push 钩子?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9038616/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:51:08  来源:igfitidea点击:

git post-push hook?

git

提问by Andrew Tomazos

Possible Duplicate:
Local executing hook after a git push?

可能的重复:
git push 后本地执行钩子?

git has a number of hooks that can call scripts near certain events.

git 有许多钩子可以在某些事件附近调用脚本。

Is it possible to setup a git hook in my working repository that executes something locally after I push to a remote branch? If so which hook is it?

是否可以在我的工作存储库中设置一个 git 钩子,以便在我推送到远程分支后在本地执行某些操作?如果是这样,它是哪个钩子?

回答by Cascabel

The list of hooks in man githooksis complete. There is no post-push hook. There are hooks which run in a repository after someone's pushed into it (i.e. for putting in the central repository), but nothing is triggered in the repository that you pushed from.

钩子列表man githooks是完整的。没有推后挂钩。有一些钩子在有人推入它之后在存储库中运行(即用于放入中央存储库),但在您从中推送的存储库中没有触发任何东西。

If there's a common task you need to do after pushing, you could make an alias which pushes then does that.

如果在推送后您需要执行一项常见任务,则可以创建一个别名,然后进行推送。