git log
is a command in Git used to display the commit history of a repository. When run, it shows the author, date, and commit message of all commits in reverse chronological order. The latest commit appears at the top of the list.
Here’s an example:
$ git log
commit b4691c6fd3feb96eed5b51c4f9ebdd5738cde0eb (HEAD -> main, origin/main, origin/HEAD)
Author: John Doe <[email protected]>
Date: Fri Jul 23 15:51:47 2021 -0400
Add new feature
commit 0e94d82558f8c8ed494e7714c7bc28c41462a9e1
Author: Jane Smith <[email protected]>
Date: Thu Jul 22 11:24:35 2021 -0400
Update documentation
commit 3028c5a76d78f6c673296b059b452fe466305d20
Author: John Doe <[email protected]>
Date: Wed Jul 21 09:17:26 2021 -0400
Fix bug in login feature
In this example, the git log
command lists the three most recent commits in the repository, showing the commit hash, the author, the date, and the commit message for each one.