Git Log – Show Commit Messages in Reverse Order

Git log shows the commit messages which are nothing but what modified in source code, who modified and when modified with the unique commit Id’s. By default, git log shows the most recent commit message at first / on top when you type “git log” command on terminal.

Note: For the demonstration we had created a simple git repository with 3 files, and 3 commits , one for text file, one for c program and one for image.

$ git log

As you can see above, the first commit message on top is most recent at time 09:09:19, then next is older to it at time 09:08:27 and the last message is at 09:06:26.

Why we need to see the git log commits in reverse order ?

When you are working on very big repository with thousand of commit message, some times there is a need to understand how this source code begin with development which may help to understand the unknown source codes.

Now, we can reverse this git log commits using “–reverse” as below,

$ git log --reverse

Now, as you can see the most older commit with number 1, is on top, and then 2 and then 3.

Leave a Comment