0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ディレクトリやブランチの差分を確認する方法

Last updated at Posted at 2025-12-20

ディレクトリやブランチの差分を確認する

ディレクトリやGitブランチの差分を確認するための主要なコマンドとそれぞれの方法をまとめる

ローカルディレクトリの差分

  • ローカル上の単なる2つのディレクトリを比較するコマンド
    diff -r <ディレクトリ1> <ディレクトリ2>

オプション

  • -r:サブディレクトなども含めて比較
  • -u:ファイル内容の差分を表示

Gitブランチ間の差分

  • Gitリポジトリないでのファイル間の差分を比較するコマンド
    git diff <比較元> <比較先>

オプション

  • --name--only:変更されたファイル名だけど一覧表示
  • --stat:変更されたファイルとそれぞれの追加・削除行数の統計を表示
  • --cached:ステージングエリアの内容と、最後にコミットした内容との差分を表示

Gitブランチとローカルディレクトリの差分

  • Gitブランチと現在の作業ディレクトリの差分
    git diff
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?