Local executing hook after a git push?

前端 未结 5 591
南笙
南笙 2020-11-27 11:07

I\'ve looked at the githooks manpage but unless I\'m missing something I don\'t see an option for local, post-push git hooks. I\'d like to have one that updates the api doc

5条回答
  •  独厮守ぢ
    2020-11-27 11:47

    This type of hook is not supported by Git. It falls outside the valid reasons for a Git hook as given by Git's maintainer.

    The introductory remark in the above linked message speaks almost directly to your case:

    I do not particularly like hooks that act after an operation is initiated locally and act solely on local data. This is maybe because I still consider git tools building blocks suitable for higher level scripting more than other people do.

    P.S. A “Single Push” Hint

    • There are too many caveats for a full explanation, but if you can figure it all out you should be able to deal with the details.

    An extra pushurl to a local repo with an “alternates” objects store could give you a low overhead way to locally execute a push hook. But really, the effort is much more than git push upstream && update-web-server (maybe in a shell alias, git alias, or script).

提交回复
热议问题