Viewing Commit History in Git
While working on a project in the Git system, sometimes you need to view the history of commits. For this purpose, we use the log
command:
git log
After running the command in the terminal, we will see a list of commits in the following format: commit number, the name of the author who made it, the date when the changes were saved, and a note about the commit.
You can display not all, but only a specified number of the latest commits. To do this, you need to add a flag with a number to the log
command, specifying the number of the latest commits. Let's display the last three commits, for example:
git log -3
View the commit history of your repository.
Limit history output to the last five commits.