git log vs git log –decorate
Keeping a track record of the changes is the best practice in programming to have a look back at older versions if an error or bug appears. In Git Bash, log history is also stored which can be investigated at any moment. It stores details like author name, date, time, email, and file name to which the user has contributed. We can consider the “git log” command to retrieve the detailed history of the logs. However, the output of the “git log” and ”git log –decorate” looks alike which confuses most of the Git users.
The outcomes of the article are:
What is the git log Command?
To display the log history, the “git log” command is utilized. It lists down the commits along with the name, email, time, and file name of all branches. The practical demonstration for the “git log” command is given below:
From the above output, you can see that the log history for the branch “master” and “topic” has been listed.
What is the git log –decorate Command?
The “–decorate” flag with the “git log” command categorized each branch commit separately along with the details the same as the “git log” command. You can check the following command’s output for better understanding:
As you can see, the commits for each branch have been listed separately.
What is the Difference Between git log and git log –decorate?
The basic difference between “git log” and “git log –decorate” is described in the following table:
git log | git log –decorate |
The “git log” displays all log history for all branches in a mixed manner. | The “git log –decorate” command displays the log history for each branch separately. |
Conclusion
The only difference between “git log” and “git log –decorate” is that the “git log” command provides the log history for all branches. While the “git log –decorate” lists the log history for all branches separately. In this guide, we have practically checked the comparison between “git log” and “git log –decorate” commands.
Source: linuxhint.com