多くのサブモジュールを含む git リポジトリがあります。サブモジュールでコミットすると、「スーパーモジュール」でコミットすることになっている git フックがあります。残念ながら、「スーパーモジュール」がそのサブモジュールの変更を検出できないように見えるため、コミット後のフックでのコミットは失敗します。
この動作を達成できる他の方法はありますか?
grunt-githooks
と を使用して Grunt を介してこれらすべてをセットアップしましたgrunt-git
。
以下は私のうなり声です:
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');
};