【发布时间】:2014-08-31 06:16:21
【问题描述】:
我有一个包含许多子模块的 git repo。当我在子模块中提交时,我有一个应该在“超级模块”中提交的 git 钩子。不幸的是,post-commit 钩子中的提交失败,因为“超级模块”似乎无法检测到其子模块中的更改。
还有其他方法可以实现这种行为吗?
我通过 Grunt 使用 grunt-githooks 和 grunt-git 进行了所有这些设置。
下面是我的 gruntfile:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
githooks: {
all: {
options: {
dest: '../../../.git/modules/server/modules/mymodule/hooks'
},
'post-commit': 'updateSuperModule'
}
},
gitcommit: {
all: {
options: {
message: 'Updated Submodule',
cwd: '../../..',
verbose: true
},
files: {
src: ['.']
}
}
},
gitpush: {
all: {
options: {
cwd: '../../..',
verbose: true
}
}
}
});
grunt.loadNpmTasks('grunt-githooks');
grunt.loadNpmTasks('grunt-git');
};
【问题讨论】:
标签: git gruntjs git-submodules githooks post-commit-hook