Gitでファイル履歴を表示するにはどうすればいいですか? 質問する

Gitでファイル履歴を表示するにはどうすればいいですか? 質問する

Subversionを使えばトータスSVNファイルの履歴/ログを表示します。

Git でこれを実行するにはどうすればよいですか?

私は特定のファイルの履歴レコードと、異なるバージョンを比較する機能を探しています。

ベストアンサー1

使用git logコミット履歴を表示するには、各コミットにはハッシュキーであるリビジョン指定子が関連付けられています(例: および14b8d0982044b0c49f7a855e396206ee65c0e787b410ad4619d296f9d37f0db3d0ff5b9066838b39。2つの異なるコミットの違いを表示するには、git diff両方のコミットのリビジョン指定子の最初の数文字を次のように入力します。

# diff between commits 14b8... and b410...
git diff 14b8..b410
# only include diff of specified files
git diff 14b8..b410 path/to/file/a path/to/file/b

コミットごとに発生したすべての差異の概要を取得したい場合は、git logまたはを使用します。git whatchangedパッチオプション付き:

# include patch displays in the commit history
git log -p
git whatchanged -p
# only get history of those commits that touch specified paths
git log path/a path/b
git whatchanged path/c path/d

おすすめ記事