問題一覧に戻る
初級ログと差分
問題13: git log - コミット履歴の表示
git logコマンドでコミット履歴を表示する方法を学びます。プロジェクトの変更履歴を確認し、いつ誰がどのような変更を行ったかを把握できます。
# リポジトリのセットアップ
echo "First file" > file1.txt
git add file1.txt
git commit -m "Initial commit"
echo "Second file" > file2.txt
git add file2.txt
git commit -m "Add second file"
echo "Update first file" >> file1.txt
git add file1.txt
git commit -m "Update file1"
# コミット履歴を表示
git
# 最新3件のコミット履歴を表示
git -3