View log

Git log

After you have created several commits, or if you have cloned a repository with an existing commit history, you’ll probably want to look back to see what has happened. The most basic and powerful tool to do this is the git log command.

By default, with no arguments, git log lists the commits made in that repository in reverse chronological order; that is, the most recent commits show up first. As you can see, this command lists each commit with its SHA-1 checksum, the author’s name and email, the date written, and the commit message.

git log
commit c7d349f0ba27a1e02238c49352e0aec1cb247921 (HEAD -> master)
Author: Ravi K R <raviram.mysore@gmail.com>
Date:   Sat Feb 4 12:30:59 2023 +0530

    hello modified again

commit 4d7bd7fbd1edca7f1fe5356bd7063a688b41b1c3
Author: Ravi K R <raviram.mysore@gmail.com>
Date:   Sat Feb 4 12:16:43 2023 +0530

    hello modified

commit 299930d241fd243ff819ea2407fe8fd5846d3594
Author: Ravi K R <raviram.mysore@gmail.com>
Date:   Sat Feb 4 11:59:52 2023 +0530

    second file added

commit b1e291c6d11016a83562294bbec1ec7e5983ffbc
Author: Ravi K R <raviram.mysore@gmail.com>
Date:   Sat Feb 4 11:35:29 2023 +0530

    initial content

One line log

A huge number and variety of options to the git log command are available to show you exactly what you’re looking for. Here, we’ll show you some of the most popular.

 git log --oneline
c7d349f (HEAD -> master) hello modified again
4d7bd7f hello modified
299930d second file added
b1e291c initial content

Other options

git log --since=2.weeks
git log -- path/to/file

Last updated