预推 git hook?

发布于 2024-09-04 19:19:13 字数 182 浏览 12 评论 0原文

我想在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

極樂鬼 2024-09-11 19:19:13

Git 在 1.8.2 版本中获得了 pre-push 挂钩。

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

1.8.2 草案发行说明谈论新的预推送挂钩:https://github.com/git/git/blob/master/Documentation /RelNotes/1.8.2.txt

Git is getting a pre-push hook in the 1.8.2 release.

Sample pre-push script: 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

半岛未凉 2024-09-11 19:19:13

查看此补丁

请参阅存储库中的 .git/hooks/ 示例挂钩,也许您会看到一些替代方案。

Take a look at this patch.

See .git/hooks/ in your repo for sample hooks, maybe you will see some alternative.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文