HomeVS Code / Dev EnvVS Code で .git が見えない? Explorer に表示する最短手順
VS Code / Dev Env ⚠ 古い情報の可能性

VS Code で .git が見えない? Explorer に表示する最短手順 VS Code で .git が見えない? Explorer に表示する最短手順

元記事を読む 古い情報の可能性
AI 3 行サマリ
  • こんにちは、「これ地味に不便だなー」と思っていた設定を 1 つ直したアーキテクトのやまぱん!
  • です 😊 補足コメントや質問、いいね、拡散、ぜひお願いします 🥺!
  • 間違っていたら 優しく 教えてください!
  • TL;DR VS Code では

VS Code を日常的に使っていると、プロジェクトルートにあるはずの `.git` フォルダが Explorer に表示されないことに気づく場面がある。これは不具合ではなく、VS Code の初期設定による意図的な非表示だ。知らないまま使い続けると、Git の内部ファイルを直接確認したいときに戸惑うことになる。

VS Code には `files.exclude` という設定項目があり、Explorer に表示しないファイルやフォルダのパターンを glob 形式で指定できる。デフォルトでは `**/.git` が `true` に設定されており、これが `.git` フォルダを隠している原因だ。設定を変更するには、コマンドパレット(Ctrl+Shift+P / Cmd+Shift+P)から「Preferences: Open Settings (JSON)」を開き、`"files.exclude"` 内の `"**/.git": true` を `false` に変えるか、該当行を削除すればよい。GUI の設定画面(Settings UI)からも同様の操作が可能で、検索欄に `files.exclude` と入力すると該当項目が表示される。

この変更はユーザー設定(グローバル)またはワークスペース設定(プロジェクト単位)のどちらにも適用できる。常に表示したい場合はユーザー設定、特定プロジェクトだけで確認したい場合はワークスペース設定に記述するのが合理的だ。

こんにちは、「これ地味に不便だなー」と思っていた設定を 1 つ直したアーキテクトのやまぱん!
🔷 VS Code / Dev Env · 本記事のポイント

`.git` フォルダの中身を直接見たい場面は意外と多い。`COMMIT_EDITMSG` で直前のコミットメッセージを確認したり、`config` ファイルでリモートURLや設定を確認したり、`hooks` ディレクトリにスクリプトを配置してコミット時の自動処理を設定したりといった用途が代表的だ。Git の仕組みを学ぶ際にも、オブジェクトストア(`objects/`)やブランチの実体(`refs/`)を目視で追えるのは理解の助けになる。

一方、`.git` を常時表示したままにするとフォルダ構造が煩雑に見えることもあるため、必要なときだけ切り替える運用も現実的だ。VS Code の設定はホットリロードされるため、JSONを保存した瞬間に反映される点も使い勝手がよい。なお、`.gitignore` とは異なり `files.exclude` はあくまで VS Code の表示制御であり、Git の追跡対象には影響しない点は押さえておきたい。

If you've ever gone looking for the `.git` folder in VS Code's Explorer pane and come up empty, you're not alone. The folder is there — VS Code is simply hiding it by default. Understanding why, and how to change it in seconds, is one of those small quality-of-life fixes that pays dividends whenever you need to peek at Git internals.

The culprit is the `files.exclude` setting. VS Code ships with a default configuration that includes `"**/.git": true`, which instructs the Explorer to omit any folder matching that pattern from its file tree. It's an intentional design choice — most users never need to browse `.git` directly, and surfacing it by default would add visual noise. But for developers who do need access, the fix is straightforward.

To make `.git` visible, open the Settings JSON file via the Command Palette (Ctrl+Shift+P on Windows/Linux, Cmd+Shift+P on macOS) and select "Preferences: Open Settings (JSON)". Find the `files.exclude` block and either set `"**/.git"` to `false` or remove the entry entirely. Alternatively, the Settings UI works just as well — search for `files.exclude` and toggle the entry from there. Changes take effect immediately without restarting the editor.

The scope of the change matters too. Applying it to user settings makes `.git` visible across every project you open, while workspace settings keep the change local to a single repository. The latter is useful if you only occasionally need to dig into Git internals for a specific project.

Why would you want to browse `.git` directly in the first place? The reasons are more common than they might seem. Checking `COMMIT_EDITMSG` for the last commit message, editing the `config` file to update a remote URL, or placing executable scripts in `hooks/` for pre-commit automation are all tasks that benefit from direct file access. Developers learning Git internals will also find it useful to visually trace how objects are stored under `objects/` or how branch references map to commit hashes in `refs/`.

It's worth noting that `files.exclude` is purely a VS Code display filter. It has no effect on what Git tracks or ignores — that remains the exclusive domain of `.gitignore` and Git's own configuration. Keeping the distinction clear avoids potential confusion, especially for developers newer to the toolchain.

For teams, it may be worth documenting whether the workspace setting is intentionally enabled, so contributors aren't surprised to see `.git` appearing in their Explorer. A brief note in a project README or contributing guide can prevent unnecessary questions. Small settings, clearly communicated, tend to save disproportionate amounts of friction over time.

  • SourceQiita VSCode tagT2
  • Source Avg ★ 1.3
  • Typeブログ
  • Importance ★ 情報 (lower priority in VS Code / Dev Env)
  • Half-life 📘 中期 (チュートリアル)
  • LangJA
  • Collected2026/06/02 19:00

本ページの本文・要約は AI による自動生成です。正確性は元記事 (qiita.com) をご確認ください。

🔷 VS Code / Dev Env の他の記事 もっと見る →

URL をコピーしました