在Git中检出新分支后,是否有办法触发钩子? [英] Is there a way to trigger a hook after a new branch has been checked out in Git?

查看:413
本文介绍了在Git中检出新分支后,是否有办法触发钩子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Git中检出新分支后,是否有办法触发一个钩子?

解决方案

这些钩子不会做到这一点我会惊讶

http://schacon.github.com/git/githooks.html



也许这一个:


post-checkout




git-checkout在
更新了工作树。钩子是
给出三个参数:
前面HEAD的引用,新HEAD
(可能或可能没有改变)的引用,
和一个标志无论
结帐是分支结账
(更改分支,标志= 1)还是文件
结帐(从
索引,标志= 0检索文件)。这个钩子不能
影响git-checkout的结果。



Is there a way to trigger a hook after a new branch has been checked out in Git?

解决方案

If one of these hooks won't do it i'd be amazed

http://schacon.github.com/git/githooks.html

Maybe this one:

post-checkout

This hook is invoked when a git-checkout is run after having updated the worktree. The hook is given three parameters: the ref of the previous HEAD, the ref of the new HEAD (which may or may not have changed), and a flag indicating whether the checkout was a branch checkout (changing branches, flag=1) or a file checkout (retrieving a file from the index, flag=0). This hook cannot affect the outcome of git-checkout.

这篇关于在Git中检出新分支后,是否有办法触发钩子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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