github copilot/VSCode + Github Copilot\343\201\247Git\343\201\256\343\202\263\343\203\237\343\203\203\343\203\210\343\203\241\343\203\203\343\202\273\343\203\274\343\202\270\343\202\222\344\275\234\346\210\220\343\201\231\343\202\213.md
... ...
@@ -0,0 +1,27 @@
1
+`git diff`をそのままGithub Copilotに渡し、コミットメッセージの作成を指示すると良い感じのコミットメッセージを出してくれる。
2
+もちろんこのやり方だけでは必要なコンテキストはコメントに含まれないが、`git commit -m WIP`よりはマシである。
3
+
4
+1. git diffを出力し、それをVSCodeで開く
5
+
6
+ ```bash
7
+ $ git add . && git diff --cached > diff.txt && code diff.txt
8
+ ```
9
+
10
+ - 適当にaliasとして登録しておくと便利。
11
+
12
+ ```bash
13
+ alias ggit="git add . && git diff --cached > diff.txt && code diff.txt"
14
+ ```
15
+
16
+2. Github CopilotのAskモードで`diff.txt`を開いた状態で以下のプロンプトを入力する。
17
+
18
+ ```
19
+ このファイルを元に日本語でコミットメッセージを作成して。コードブロックの中に出力して。
20
+ ```
21
+
22
+3. コミットメッセージが出力される。
23
+
24
+
25
+- 備考
26
+ - 生成後に`diff.txt`は不要なので、消しても良いし、`.gitignore`と`.copilotignore`に入れておいてもいい。
27
+ - 多分`.github/copilot-instructions.md`にコミットメッセージのテンプレートを書いておくと従ってくれる。Askモードでも`.github/copilot-instructions.md`を参照しているようだ。
... ...
\ No newline at end of file