まとめと実践
重要なポイント
- は プロジェクトのセーブポイントです — いつでも戻れる完全なタイムラインであり、だからこそ恐れずに AI を解き放てます。
- 基本のリズムは
add→commit→pushです:変更を stage し、明確なメッセージを付けた として保存し、バックアップと共有のために GitHub へ送ります。 - 大きな作業の前にはブランチを切り、コミットのたびに diff を読みましょう — AI が消してはいけないものを消すのを捕まえる方法です。
.gitignoreは秘密(.envなど)とゴミ(node_modules/など)を履歴から除外します。GitHub にコミットされた秘密は、あとで削除しても永遠に漏れたものとして扱います。- AI にコマンドを実行させてもかまいませんが、各コマンドが何をしたか理解する責任は自分にあります — 特に
reset --hardのような破壊的なものは。
やってみよう
まっさらな新しいフォルダを作り、全体の流れを自分の手で回してみましょう:git init、.env を含む .gitignore を作成、シンプルな notes.txt ファイルを追加、そして git add . と git commit -m "Initial commit"。次に git log --oneline を実行してセーブポイントを見て、ファイルを編集してから git diff を実行し、Git が何が変わったかを正確に見せてくれる様子を観察します。何も壊れようのないプロジェクトで、この章の核となる習慣をすべて使ったことになります。
この章のプロンプト
I'm learning Git as a beginner and I want you to run the commands for me,
but teach as you go. For the task below:
<describe what you want to do — e.g. "save my current work" or "try a risky change safely">
- Tell me which Git commands you'll run and what each one does in plain English.
- If anything is destructive (reset --hard, force-push, deleting a branch),
warn me clearly and explain what I'd lose before doing it.
- Before any commit, show me the diff and summarize what changed.
- Remind me if there's anything in the change that shouldn't be public (secrets, keys).