{
    "componentChunkName": "component---src-templates-blog-post-js",
    "path": "/2022-07-06_reset-git-hooks/",
    "result": {"data":{"site":{"siteMetadata":{"title":"365"}},"markdownRemark":{"id":"33046783-53ab-5a49-bd07-57dbde108dba","excerpt":"Velociraptor の設定変更をしたが変更が反映されなかったため 再 clone して修正するのもおかしな話なのでできる方法が無いかを探した 初期化方法  を削除して  を実行すれば OK 既に存在しているリポジトリで  を行うと再初期化できる 再初期化に Git Hooks…","html":"<p>Velociraptor の設定変更をしたが変更が反映されなかったため<br>\n再 clone して修正するのもおかしな話なのでできる方法が無いかを探した</p>\n<h2>初期化方法</h2>\n<p><code class=\"language-text\">.git/hooks/</code> を削除して <code class=\"language-text\">git init</code> を実行すれば OK<br>\n既に存在しているリポジトリで <code class=\"language-text\">git init</code> を行うと再初期化できる</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">$ rm -rf .git/hooks \n$ git init\nReinitialized existing Git repository in /path/to/project/.git/</code></pre></div>\n<p>再初期化に Git Hooks 初期化が行われて、 <code class=\"language-text\">.git/hooks/</code> が作成される<br>\n変更した Git Hooks の設定を反映することができた</p>\n<p>再初期化といっても現在の変更がなくなるとかは無い</p>\n<h2>確認</h2>\n<p>hooks が設定済みの状態、 <code class=\"language-text\">pre-commit</code> などがある</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">$ ls .git/hooks/           \napplypatch-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\napplypatch-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\ncommit-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\n\n$ ls .git/hooks/pre-commit\n.git/hooks/pre-commit</code></pre></div>\n<p>差分がある状態</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">$ git diff --name-only\ncommand.ts</code></pre></div>\n<p>hooks 削除して再初期化を実施</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">$ rm -rf .git/hooks/\n$ git init\nReinitialized existing Git repository in /path/to/project/.git/</code></pre></div>\n<p>hooks があるが、 sample のみ</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">$ ls .git/hooks/    \napplypatch-msg.sample  fsmonitor-watchman.sample  pre-applypatch.sample  pre-merge-commit.sample    pre-push.sample    pre-receive.sample       update.sample\ncommit-msg.sample      post-update.sample         pre-commit.sample      prepare-commit-msg.sample  pre-rebase.sample  push-to-checkout.sample</code></pre></div>\n<p>hooks 再設定</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">$ vr</code></pre></div>\n<p>pre-commit があることを確認</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">$ ls .git/hooks/\napplypatch-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\napplypatch-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\ncommit-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\n\n$ ls .git/hooks/pre-commit\n.git/hooks/pre-commit</code></pre></div>\n<p>差分がある状態のまま</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">$ git diff --name-only\ncommand.ts</code></pre></div>\n<h2>参考</h2>\n<ul>\n<li><a href=\"https://www.xn--ebkc7kqd.com/entry/git-hook-init\">Git hookを初期化する - テクめも</a></li>\n<li><a href=\"https://qiita.com/ragingalpaca/items/ef247e459ff2e7759ba9#%E3%81%A1%E3%81%AA%E3%81%BF%E3%81%ABreinitialized%E3%81%A8%E3%81%84%E3%81%A3%E3%81%A6%E3%82%82\">git initで”Reinitialized existing Git repository in …”とか出たのをエラーと勘違いした - Qiita</a></li>\n</ul>","frontmatter":{"title":"Git Hooks を初期化する","date":"2022/07/06","description":null}},"previous":{"fields":{"slug":"/2022-07-05_deno-task-runner_velociraptor/"},"frontmatter":{"title":"Deno タスクランナーに Velociraptor を入れる"}},"next":{"fields":{"slug":"/2022-07-20_date_utc8/"},"frontmatter":{"title":"今 UTC+9 ではなく、 UTC+8 の場所にいるので Mac の date コマンドで見てみる"}}},"pageContext":{"id":"33046783-53ab-5a49-bd07-57dbde108dba","previousPostId":"8d6dcdb3-2f92-5f58-b519-1bec8f30e6cd","nextPostId":"f5afd985-ca73-5569-82ee-e627bd501823"}},
    "staticQueryHashes": ["2841359383","3257411868"]}