Technology and General Blog

A git repository includes several commits is dependent on the venture job. Often the git person demands to clone a repository with the present commits and may well involve to know the past git commit heritage. `git log` command is used to check out the commit record and display screen the required info of the git repository. This command shows the latest git commits details in chronological order, and the previous dedicate will be displayed very first. The unique ways to check out the commit historical past of the git repository by employing the `git log` command have been discussed in this tutorial.


Put in GitHub Desktop.

GitHub Desktop will help the git user to conduct the git-related tasks graphically. You can easily download the newest installer of this software for Ubuntu from You have to put in and configure this software immediately after down load to use it. You can also check the tutorial for setting up GitHub Desktop on Ubuntu to know the set up course of action effectively.

Build a GitHub account.

You will require to produce a GitHub account to look at the output of the commands in the remote server.

Develop a nearby and remote repository.

You have to generate a community repository and publish the repository in the remote server to test the commands applied in this tutorial. Go to the community repository folder to examine the commands applied in this tutorial.

See commit historical past:

The commit history can be viewed in different means by making use of the `git log` command. A nearby repository named bash has been utilized in this tutorial to check the instructions applied in this tutorial. Operate the following command to check out the commit background of the repository. The output will consist of the dedicate SHA value, username and e mail of the writer, commit date and time, and the commit concept.

The following output shows that two commits have been performed in the present repository by the identical creator on the identical day but at different moments. Two distinctive commit SHA values have been made for two distinct commits.

The commit history can be viewed dependent on the dedicate SHA benefit making use of the `git show` command. Run the subsequent command to see the dedicate record of the provided dedicate SHA.

$ git demonstrate ab35d03c8f4f238fd94f0ec3abd533dbe0b5a352

The output reveals the details of the dedicate heritage dependent on the unique dedicate SHA value. The other details these kinds of as the filename, file method, index worth, and the articles of the dedicated file have exhibited right here. It aids the git consumer to determine the vital dedicate that the person wishes to modify or proper.

The -p or –patch solution is utilized with the `git log` command to exhibit the variation in each dedicate. The view of the log entries can be minimal by defining a unique number with this solution. Operate the pursuing command to show the hottest dedicate historical past.

The subsequent output will look right after executing the over command. It appears like the former output due to the fact only a single dedicate historical past has been retrieved here. When the various dedicate record is shown by raising the limit benefit, the difference between the commit heritage will be cleared.

The –stat choice is utilized with the `git log` command to display screen some point out information with the dedicate heritage.

The subsequent output demonstrates that the .gitattributes file has been inserted in the preliminary commit. The file has been inserted in the next dedicate of the repository with the other commit facts.

The –online alternative of the `git log ` command shows the commit historical past in a solitary line with the small commit SHA worth. When the repository is made up of many commits, the `git log` command will extended. The output of all dedicate historical past can be exhibited in the limited form by applying the –online solution that will help to see a huge number of dedicate background appropriately.

The next output will show up soon after executing the earlier mentioned command. Here, the initially 7 people of the dedicate SHA value have exhibited for each individual dedicate.

The –pretty is an additional choice of `git log` to exhibit the log output in several formats. This alternative can be used by assigning distinctive forms of values, and the output of the command is dependent on the assigned benefit.  Run the pursuing command to see the dedicate background in the limited form by assigning on the web for the –pretty alternative.

$ git log –really=oneline

The output of the earlier mentioned command is identical to the previous command except for the dedicate SHA worth. Right here, the complete commit SHA worth has shown.

Lots of placeholders exist, which are defined by the character literals to structure the log output. The log output can be formatted in accordance to the user’s necessity by defining the format with the correct string price in the –pretty selection. Operate the next command to print the commit SHA price in the shorter form, the git username, and the commit message in the way that has been outlined in the string. Here, %h is used to display screen the dedicate SHA worth in the shorter variety, %an is utilized to display the author’s username, and %s is made use of to display screen the dedicate information.

$ git log –fairly=format:“%h – %an : %s”

The following output will seem right after executing the previously mentioned command.


The commit background is an crucial portion of any git repository.  The git consumer can get an plan about just about every dedicate of the repository by viewing the commit history and making the needed modification. The distinctive strategies to look at the commit record have been demonstrated in this tutorial working with a demo repository.

Leave a Reply

Your email address will not be published. Required fields are marked *