git - 是否有 "git hook"命令?

标签 git

尝试运行命令时:

git p4 submit --shelve

(运行 git-p4.py)我收到错误:

git: 'hook' is not a git command. See 'git --help'.

当我查看 git-p4.py 的代码时,我看到它正在尝试运行命令:

git hook run p4-prepare-changelist

但是,好像真的没有像git hook这样的命令!错误消息说明了一切!那么这是怎么回事?

最佳答案

据我所知git hook run将仅与 Git 2.36(2022 年第二季度)一起发布。

code评论中提到的已经被git/git commit 0c8ac06介绍过了,这也适用于下一个 Git 版本。

It seems like the only way to get git-p4.py is to copy it from github . The one I have is the latest one from master

这意味着您需要一个与您的 git 版本
匹配的版本 例如:

https://github.com/git/git/blob/v2.35.1/git-p4.py

关于git - 是否有 "git hook"命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71435280/

相关文章:

git - 对于 Codeception 测试,git 中应该提交或忽略什么?

git - 有没有办法 'script' 一个 git commit - 只接受一些差异?

git - 新的 gitlab 实例拒绝推送

python - 在谷歌云函数中访问用户定义的包(ModuleNotFoundError : No module named. ..)

git - Android Studio 3.3.1中Github命令 "Update Project"和 "Pull"的区别?

git - 从 Github 更新克隆的存储库

git - 如何使用 git 获取某人提交的所有分支?

git - 如何让我的本地 Git 存储库可供多个用户访问?

android - 从 AOSP 编译电子邮件应用程序

git - 如何让 Sublime Text 成为 Git 的默认编辑器?