FreeKB - Git (Version Control) git log command
Git (Version Control) - git log command

This assumes you are already cloned a repository from the source Git repo (typically called "origin") to a directory on your PC, such as the foo.git or bar.git repos.


After cloning a repository, by default, you will have a branch called "master" on your PC.


Let's say there is a file named foo.txt in the repo. The git log command can be used to view the history of commits. In this example, every commit of foo.txt will be displayed.

git log foo.txt


The log will display entries like this.

commit  mks910122020slsmm3lsosos020399489sl
Author: John Doe <>
Date:   Wed May 31 14:51:14 2020 -0500

  Third commitment

commit dkci85474fjfdkd9393934k49f9fk002kd01
Author: John Doe <>
Date:   Tue May 30 18:23:36 2020 -0500

  Second commitment

commit fj83m3ld0d0d3m3ld0389303l3ld0d0d39dl
Author: John Doe <>
Date:   Mon May 29 20:26:09 2020 -0500

  First commitment


Sometimes, it's a tad easier to work witht the --oneline flag.

git log --oneline


Which will produce output like this:

bk19sl1 Third commit
8jfj20d Second commit
afba75a First commit


Or even better, you can fine tune the output.

git log --pretty=format:%h,%cn,%cd,%s --date=local


Which will produce output like this:

bk19sl1,John Doe,Wed May 31 14:51:14 2020,Third commit
8jfj20d,John Doe,Tue May 30 18:23:36 2020,Second commit
afba75a,John Doe,Mon May 29 20:26:09 2020,First commit


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 16e6d in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |