Log
Published May 25, 2023
Contribute to Docs
In Git, the log
command is used to track a branch’s commit history. After running, it will display project-related information, such as a detailed commit history, which can be used as a reference to go back in time to a previous version of the project.
Example
Below is a short example of how the git log
command works. Running git log
will show a list of all previous commits on the current branch:
$ git logOn current branchcommit f5b5bd8f9eaa443d4020cbe918x742e7ddd22000Author : John Doe <[email protected]>Date: Mon May 22 14:21:03 2023 -0400.
The example log above shows the different elements that make up a commit, but the most useful is the git hash (f5b5bd8f9eaa443d4020cbe918x742e7ddd22000), which can be used to revert our commit changes using the git revert command.
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Git on Codecademy
- Course
Learn Git & GitHub
Use our beginner friendly Git course to integrate Git and GitHub and manage versions of your projects using Git branches.With CertificateBeginner Friendly4 hours - Course
Learn the Command Line
Learn about the command line, starting with navigating and manipulating the file system, and ending with redirection and configuring the environment.With CertificateBeginner Friendly4 hours