我有一个包含许多子模块的 git repo。当我在子模块中提交时,我有一个应该在“超级模块”中提交的 git 钩子。不幸的是,提交后挂钩中的提交失败,因为“超级模块”似乎无法检测到其子模块中的更改。
有没有其他方法可以实现这种行为?
grunt-githooks
我通过 Grunt 使用and设置了所有这些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');
};