How to Make Reports in Git

Abdul Jabbar Feb 02, 2024
  1. Use the git log Command to Make Reports in Git
  2. Use the git shortlog Command to Make Reports in Git
How to Make Reports in Git

Git is considered the most demanding and efficiently used version control system for every software developer and team. We can also say that it is built for data integrity and speed and supports distributed non-linear workflows in a group.

As software developers who use Git, everyone thinks about the information regarding our project. This includes if we have not analyzed the git commit log, if the customer wants a detailed report about the project activity, or if the project manager wants the command execution the team has done.

Below are some questions asked regarding frequently changed files:

  • who is the vigorous contributor,
  • on which days these contributors are actively participating,
  • are they adding code or deleting it, and
  • many more questions are present in our Git commit log.

Use the git log Command to Make Reports in Git

Firstly, we will build a report through git log for our activity using the author setting because some people might work on the same project in a team:

git log --author=ABC

This will generate an output of the author’s commits and pull.

The next step is to limit the period we want to show, for example, last week, last month, or last year. We will use since and until with options in the git log command:

git log --author=Johnson --since='1 Monday ago' --until='now'

The output is the same, but this will only show the work from last Monday. We can also do this as follows:

git log --author=Marco --since='2 Monday ago' --until='1 Monday ago'

Use the git shortlog Command to Make Reports in Git

The git shortlog command sums up the git log output.

It will work with the same option as the git log command works. However, rather than showing all the commits of the entire project, it will only show summarized commits that the specified author grouped.

For instance, the following command will summarize all the commits since our last release, v1.0.2.

$ git shortlog --no-merges master --not v1.0.2

Through the above command, we get a clean summary of all the commits done by the team since v1.0.2.

Author: Abdul Jabbar
Abdul Jabbar avatar Abdul Jabbar avatar

Abdul is a software engineer with an architect background and a passion for full-stack web development with eight years of professional experience in analysis, design, development, implementation, performance tuning, and implementation of business applications.

LinkedIn