4

我想在此之前运行一个压缩脚本,git push这样每当用户尝试将更改推送到远程存储库时,它都会检查可压缩资产中未提交的更改,中止git push,运行git commit,然后git push再次运行。

仅使用 git 钩子可以实现类似的事情吗?

4

2 回答 2

5

Git在这个版本中获得了一个pre-push钩子。1.8.2

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

1.8.2 版本说明草案谈论新的 pre-push hook:https ://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt

于 2013-02-03T13:24:09.623 回答
3

看看这个补丁

在您的仓库中查看.git/hooks/示例挂钩,也许您会看到一些替代方案。

于 2010-06-07T19:15:52.253 回答