我希望在git push
之前运行一个压缩脚本,这样每当用户试图将更改推送到远程仓库时,就会检查可压缩资产中是否存在未提交的更改,终止git push
,运行git commit
,然后再次运行git push
。
只使用git hooks是否可能实现这样的功能?
pre-push
挂钩。
pre-push
示例脚本:https://github.com/git/git/blob/87c86dd14abe8db7d00b0df5661ef8cf147a72a3/templates/hooks--pre-push.sample
1.8.2草案版本说明介绍了新的pre-push
挂钩:https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.2.txt