在Git中检出新分支后,是否有办法触发钩子? [英] Is there a way to trigger a hook after a new branch has been checked out in 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屋!