git - 预推git钩子(Hook)?

标签 git githooks

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

仅使用 git hooks 是否可以实现类似的功能?

最佳答案

Git 在 1.8.2 版本中获得了一个 pre-push Hook 。

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

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

关于git - 预推git钩子(Hook)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2992128/

相关文章:

javascript - 无法解析主机 github.com

git - 在版本控制上更新 pre_commit Hook 文件

python - 关于 git push heroku 主命令的错误,pywin32 错误

c++ - Eclipse Oxygen 和 org.eclipse.jface 给出 NullPointerException 对话框

linux - 如何在 Ubuntu 20.04 中安装 Git

用于 merge 冲突的 Git 钩子(Hook)

git - 在 git pre-commit hook 中临时修改工作目录和暂存区

git - 是否可以使用 git hook 在暂存、添加或推送之前替换密码?

ruby - 使用 rake 数据库 :migrate in git hook - undefined class/module Encoding

git - 如何为特定提交生成 Git 补丁?