0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VS Codeでファイル差分を確認する2つの方法

0
Last updated at Posted at 2026-01-02

はじめに

VS Code でファイルの差分(diff)を取得する方法を紹介します。

前提

  • 比較するファイルは同じワークスペース内に配置されている必要があります。

手順

手順1. エクスプローラーから比較する

1. 最初のファイルで「Select for Compare」を選ぶ

  • VS Code のエクスプローラー(左ペイン)で比較したい片方のファイルを右クリックし、コンテキストメニューから「Select for Compare」を選択します。

image.png

2. もう一方のファイルで「Compare with Selected」を選ぶ

  • 続けて比較したいもう一方のファイルを右クリックし、「Compare with Selected」を選択します。

image.png

3. 差分ビューを確認する

  • すぐに差分ビューが開き、左右ペインで差分を確認できます。

image.png

手順2. コマンドパレットを利用する

1. 片方のファイルを開いてアクティブにする

  • 比較対象のうち、まず片方のファイルをエディターで開き、アクティブ状態にします。

image.png

2. コマンドパレットで比較コマンドを呼び出す

image.png

3. 比較先のファイルを選択する

  • ダイアログまたはクイックピックから、比較したいもう一方のファイルを選択します。

image.png

4. 差分ビューを確認する

  • 差分ビューが表示されます。
  • 左右ペインで差分がハイライト表示され、上部のナビゲーションで差分間を移動できます。

image.png

環境

Version: 1.107.0 (user setup)
Commit: 618725e67565b290ba4da6fe2d29f8fa1d4e3622
Date: 2025-12-10T07:43:47.883Z
Electron: 39.2.3
ElectronBuildId: 12895514
Chromium: 142.0.7444.175
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.26100
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?