Tuesday 16 July 2019

Git: Check commit history


'git log' command used to get the commit logs.

For example, clone the repository https://github.com/harikrishna553/gitHelloWorld.git by executing below command.

$git clone https://github.com/harikrishna553/gitHelloWorld.git
Cloning into 'gitHelloWorld'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 18 (delta 0), reused 9 (delta 0), pack-reused 0
Unpacking objects: 100% (18/18), done.
$
$tree
.
└── gitHelloWorld
    ├── README.md
    └── welcome.txt

1 directory, 2 files


Navigate to ‘gitHelloWorld’ and execute the command ‘git log’ to get previous commit history.

$cd gitHelloWorld/
$
$git log
commit 62f16b21c4c1fced843bf4fc8f2a096c1096ad15 (HEAD -> master, origin/master, origin/HEAD)
Author: harikrishna553 <harikrishna@abcd.com>
Date:   Wed Jun 26 09:36:02 2019 +0530

    Update welcome.txt

commit deb0c7cd4840bab7290c7224cae6ff2de3eadc2e
Author: krishna <krishna@abcd.com>
Date:   Wed Jun 26 09:31:06 2019 +0530

    Updated welcome.txt file

commit e875f7477dd696168ac2b1462950fa469a407299
Author: harikrishna553 <harikrishna@abcd.com>
Date:   Tue Jun 25 09:23:56 2019 +0530

    Update welcome.txt

commit fdf597bfb8e095a7123e7112c15162dfb2b93b86
Author: krishna <krishna@abcd.com>
Date:   Mon Jun 24 14:27:31 2019 +0530

    Added welcome message to welcome.txt file

commit 70d8ded0de055bfdd9cbf4adf3a624d466ed26f4
Author: krishna <krishna@abcd.com>
Date:   Mon Jun 24 12:33:39 2019 +0530

    Adding welcome.txt to the repository

commit e7e108876a43882832eeea65b45b86e6815e1eef
Author: harikrishna553 <harikrishna@abcd.com>
Date:   Mon Jun 24 12:16:14 2019 +0530

    Initial commit
$


As you see the output of 'git log' command, most recent commits are shown first.


Previous                                                    Next                                                    Home

No comments:

Post a Comment