Velociraptor の設定変更をしたが変更が反映されなかったため
再 clone して修正するのもおかしな話なのでできる方法が無いかを探した
初期化方法
.git/hooks/ を削除して git init を実行すれば OK
既に存在しているリポジトリで git init を行うと再初期化できる
$ rm -rf .git/hooks
$ git init
Reinitialized existing Git repository in /path/to/project/.git/再初期化に Git Hooks 初期化が行われて、 .git/hooks/ が作成される
変更した Git Hooks の設定を反映することができた
再初期化といっても現在の変更がなくなるとかは無い
確認
hooks が設定済みの状態、 pre-commit などがある
$ ls .git/hooks/
applypatch-msg commit-msg.sample post-checkout post-rewrite pre-applypatch pre-commit pre-merge-commit.sample pre-push pre-rebase.sample push-to-checkout.sample
applypatch-msg.sample fsmonitor-watchman.sample post-commit post-update pre-applypatch.sample pre-commit.sample prepare-commit-msg pre-push.sample pre-receive.sample sendemail-validate
commit-msg post-applypatch post-merge post-update.sample pre-auto-gc pre-merge-commit prepare-commit-msg.sample pre-rebase push-to-checkout update.sample
$ ls .git/hooks/pre-commit
.git/hooks/pre-commit差分がある状態
$ git diff --name-only
command.tshooks 削除して再初期化を実施
$ rm -rf .git/hooks/
$ git init
Reinitialized existing Git repository in /path/to/project/.git/hooks があるが、 sample のみ
$ ls .git/hooks/
applypatch-msg.sample fsmonitor-watchman.sample pre-applypatch.sample pre-merge-commit.sample pre-push.sample pre-receive.sample update.sample
commit-msg.sample post-update.sample pre-commit.sample prepare-commit-msg.sample pre-rebase.sample push-to-checkout.samplehooks 再設定
$ vrpre-commit があることを確認
$ ls .git/hooks/
applypatch-msg commit-msg.sample post-checkout post-rewrite pre-applypatch pre-commit pre-merge-commit.sample pre-push pre-rebase.sample push-to-checkout.sample
applypatch-msg.sample fsmonitor-watchman.sample post-commit post-update pre-applypatch.sample pre-commit.sample prepare-commit-msg pre-push.sample pre-receive.sample sendemail-validate
commit-msg post-applypatch post-merge post-update.sample pre-auto-gc pre-merge-commit prepare-commit-msg.sample pre-rebase push-to-checkout update.sample
$ ls .git/hooks/pre-commit
.git/hooks/pre-commit差分がある状態のまま
$ git diff --name-only
command.ts