To view the Git log, you can use the following command in your terminal while inside your Git repository:
git log
This command will display the commit history in reverse chronological order, showing the most recent commits first. Each log entry will include details such as the commit hash, author, date, and commit message.
Additional Options
You can customize the output of the git log command with various options:
-
One-line format:
To view a simplified version of the log with each commit on a single line, use:git log --oneline -
Show a specific number of commits:
To limit the number of commits displayed, you can specify a number:git log -n 5(This will show the last 5 commits.)
-
View changes made in each commit:
To see a summary of changes made in each commit, use:git log --stat -
View commits by a specific author:
To filter commits by a specific author, use:git log --author="Author Name" -
Search for a specific commit message:
To search for commits with a specific keyword in the commit message, use:git log --grep="keyword"
You can combine these options as needed to tailor the log output to your requirements.
