预推 git hook?
我想在 git Push 之前运行一个压缩脚本,以便每当用户尝试将更改推送到远程存储库时,它都会检查可压缩资产中未提交的更改,并中止 git Push code>,运行 git commit
,然后再次运行 git push
。
仅使用 git hooks 可以实现类似的功能吗?
I would like to run a compression script before git push
such that anytime a user tries to push changes to a remote repository, it checks for uncommitted changes in the compressible assets, aborts git push
, runs git commit
, then runs git push
again.
Is something like that possible using only git hooks?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Git 在
1.8.2
版本中获得了pre-push
挂钩。示例
预推送
脚本:https://github.com/git/git/blob/87c86dd14abe8db7d00b0df5661ef8cf147a72a3/templates/hooks--pre-push.sample1.8.2 草案发行说明谈论新的预推送挂钩:https://github.com/git/git/blob/master/Documentation /RelNotes/1.8.2.txt
Git is getting a
pre-push
hook in the1.8.2
release.Sample
pre-push
script: https://github.com/git/git/blob/87c86dd14abe8db7d00b0df5661ef8cf147a72a3/templates/hooks--pre-push.sample1.8.2 draft release notes talking about the new pre-push hook: https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt
查看此补丁。
请参阅存储库中的 .git/hooks/ 示例挂钩,也许您会看到一些替代方案。
Take a look at this patch.
See
.git/hooks/
in your repo for sample hooks, maybe you will see some alternative.