我想在此之前运行一个压缩脚本,git push
这样每当用户尝试将更改推送到远程存储库时,它都会检查可压缩资产中未提交的更改,中止git push
,运行git commit
,然后git push
再次运行。
仅使用 git 钩子可以实现类似的事情吗?
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
看看这个补丁。
在您的仓库中查看.git/hooks/
示例挂钩,也许您会看到一些替代方案。