Debug School

rakesh kumar
rakesh kumar

Posted on

Git:show the commits made in the last three days:

The git log --name-only --pretty=format: command shows the commit history of a Git repository, displaying only the commit ID and the names of the files that were changed in each commit. The --name-only option specifies that only the filenames should be displayed, and the --pretty=format: option specifies the format of the output.

Here's an example of how to use the git log --name-only --pretty=format: command with the --since option to show the commits made in the last three days:

git log --name-only --pretty=format: <commit-ID>^..HEAD --since=3.days.ago
Enter fullscreen mode Exit fullscreen mode

Here are a few examples of how to use this command:

1.To show the commit history of the current branch from three days ago up to the most recent commit:

git log --name-only --pretty=format: HEAD --since=3.days.ago
Enter fullscreen mode Exit fullscreen mode

2.To show the commit history of a specific branch from three days ago up to the most recent commit:

git log --name-only --pretty=format: <branch-name> --since=3.days.ago
Enter fullscreen mode Exit fullscreen mode

3.To show the commit history of a specific commit from three days ago up to the most recent commit:

git log --name-only --pretty=format: <commit-ID>^..HEAD --since=3.days.ago
Enter fullscreen mode Exit fullscreen mode

In each of these examples, the --name-only option specifies that only the filenames should be displayed, and the --pretty=format: option specifies the format of the output. The --since option specifies the time frame for which to show the commit history, in this case the last three days. The and placeholders should be replaced with the actual commit ID or branch name, respectively.

Top comments (0)