In this article am going to show you how to view the Git's History by using Git command line instructions.
You can see Git's commit history in several ways by using different git commands. now let's start with the examples below. before going to Git repository, just give as
git help log command, you can see so many types of commands which we are using.
So the above command will bring help for a specific command, This will show you several options, so we can see a few of them in this article, And if you are on the window, a browser page will open up for you and you can see different command options in that and can close that page at this point.
cdto your working directory.
git status, it will show you, your working directory is clean and in some cases, it will show some untracked files at the operating system level(if you have any untracked file).
Now let us check, what does the default git status command
git log will give us, You can see the commit history in reverse chronological order as shown in the below image.
And here the top starts with the last commits and bottoms ends with the beginning of commit history, Here the first line is committed and then followed by a long string of characters, that's the SHA-1 identifier.
This is how the Git Identifies each commits uniquely and also followed by the author's name and email address, the date when the commit happened and also with a commit message.
git log --abbrev-commit
So typically you need six to seven characters to identify uniquely a commit in the Git repository, As your Git repository grows in size, the number of identifying uniquely may also grow a little bit.
Now you can see more options and change the view even more by using
git log --oneline --graph --decorate.
Here the above command will display our log command but the --online will compress our entries into oneline and --graph will provide an ASCII graph duplicating the branching graph and --decorate will add any labels or tags or anything that sort of annotates out commits.
You can see that, different commit history and at the top, you can see a master branch which is pointing to the latest commits and several commits further, You can also see that origin/master is pointing to the earlier commit history.
Now press "q" to get out of that, In the next example, you can specify a range of the commit history, here, I am specifying first commit down to a few commits later as shown in the below image and press enter
git log will only show you those commits which you are interested in.
Another command, which you can use with log is date-based searching, let's type
git log --since="3 days ago", so this will just bring up the commits that have happened 3 days ago.