Status and Log
git log lists commits, newest first. Useful options are --oneline, --graph, -n and --format. Commit messages should say what and why in a short line.
Example
echo a > a.txt; git add .; git commit -q -m "First"
echo b > b.txt; git add .; git commit -q -m "Second"
echo c > c.txt; git add .; git commit -q -m "Third"
git log --format=%s
git log -n 2 --format="* %s"
git rev-list --count HEADResult
Third Second First * Third * Second 3
Exercise
Show only the last 2 commits.
git log 2
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.