在pull --rebase之后执行git-hook [英] Executing a git-hook after pull --rebase

查看:87
本文介绍了在pull --rebase之后执行git-hook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在执行git pull --rebase之后运行钩子,以检查某个文件是否已更改.类似于钩子.

I'd like to have a hook run after doing git pull --rebase in order to check if a certain file was changed. Something along the lines of this hook.

我最初想到使用post-rewrite钩子,但是它仅在重写提交时才起作用,而当pull操作只是快进分支时却不运行,这种情况经常发生.

I initially thought of using the post-rewrite hook, however that only works when commits are being rewritten, and won't run when the pull operation simply fast-forwards the branch, which is very often.

任何想法都会受到赞赏.

Any ideas will be appreciated.

推荐答案

我在本地存储库中运行了strace git pull --rebase,该存储库执行了快速更新...

I ran strace git pull --rebase on a local repository, which performed a fast-forward update...

First, rewinding head to replay your work on top of it...
Fast-forwarded master to b0a60c3302973ca1878d149d61f2f612c8f27fac.

...,在这种情况下,似乎git调用了post-checkout钩子:

...and it looks as if git calls the post-checkout hook in this case:

这篇关于在pull --rebase之后执行git-hook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆