简体   繁体   English

预推git钩?

[英]pre-push git hook?

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. 我想在git push之前运行压缩脚本,这样当用户尝试将更改推送到远程存储库时,它会检查可压缩资产中未提交的更改,中止git push ,运行git commit ,然后再次运行git push

Is something like that possible using only git hooks? 是这样的,只使用git钩子吗?

Git is getting a pre-push hook in the 1.8.2 release. Git正在1.8.2版本中获得pre-push钩。

Sample pre-push script: https://github.com/git/git/blob/87c86dd14abe8db7d00b0df5661ef8cf147a72a3/templates/hooks--pre-push.sample 示例pre-push脚本: https//github.com/git/git/blob/87c86dd14abe8db7d00b0df5661ef8cf147a72a3/templates/hooks--pre-push.sample

1.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 1.8.2草案发布说明谈论新的预推钩: https//github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt

Take a look at this patch . 看看这个补丁

See .git/hooks/ in your repo for sample hooks, maybe you will see some alternative. 请参阅回购中的.git/hooks/以获取示例挂钩,也许您会看到一些替代方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM