snippetjavascriptTip
View the last Git commit
Viewed 0 times
lastviewgitcommitthe
Problem
Checking the contents of the last Git commit can sometimes be useful to orient yourself in the repository's history. The
Using
git log command can help you with this by displaying the last commit in the repository.Using
git log -1, you can view the last commit in the repository. This command will show you the commit hash, author, date, and commit message of the last commit. You can navigate through the commit history using the arrow keys and exit by pressing <kbd>Q</kbd>.Solution
# Syntax: git log -1
git log -1
# commit c191f90c7766ee6d5f24e90b552a6d446f0d02e4
# Author: 30 seconds of code
# Date: Tue Apr 6 11:11:08 2021 +0300
# [...]Code Snippets
# Syntax: git log -1
git log -1
# commit c191f90c7766ee6d5f24e90b552a6d446f0d02e4
# Author: 30 seconds of code
# Date: Tue Apr 6 11:11:08 2021 +0300
# [...]Context
From 30-seconds-of-code: view-last-commit
Revisions (0)
No revisions yet.