Debug School

rakesh kumar
rakesh kumar

Posted on

Git:all commits made between 3 days ago

Sure, here's an example of how you could use the git log command you provided to view the commit history for a repository, including the names of the files that were changed in each commit, for all commits made between 3 days ago and 2 days ago:

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

In this example, we're using the commit ID abcd123 as the starting commit. We want to include all commits between abcd123 and the current branch tip, but exclude the abcd123 commit itself, which is indicated by the ^ symbol. We're also specifying a time range of commits from 3 days ago until 2 days ago.

Here's an example output of what the command might look like:

commit 1234abcd5678
file1.txt
file2.txt

commit 2345bcde6789
file3.txt

commit 3456cdef7890
file4.txt
file5.txt
Enter fullscreen mode Exit fullscreen mode

In this example, we can see that there were three commits made in the repository between 3 days ago and 2 days ago, and the names of the files that were changed in each commit are listed underneath the commit message. Note that the actual commit IDs and file names will vary depending on the repository and the changes that were made.

This command will show you the commit history for the repository, including the names of the files that were changed in each commit, for all commits made between 3 days ago and 2 days ago, based on the current date. Here's a breakdown of the different parts of the command:

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

git log: This is the command for viewing the commit history of a repository.
--name-only: This option tells Git to include only the names of the files that were changed in each commit.
--pretty=format:: This option specifies the format for the output. In this case, we're not actually formatting the output, but leaving it blank, so that only the commit hash and file names are shown.
--since=3.days.ago --until=2.days.ago: This specifies the time range of commits to include in the log. 3.days.ago and 2.days.ago are relative time specifications, meaning that 3.days.ago refers to the same time of day as 3 days ago, and 2.days.ago refers to the same time of day as 2 days ago.
When you run this command, you will see a list of all commits in the specified time range, along with the names of the files that were changed in each commit.

Here's an example of how you could use the command:

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

In this example, we're not specifying a starting commit ID, which means that Git will show all commits in the specified time range. We're also specifying a time range of commits from 3 days ago until 2 days ago.

When you run this command, you will see a list of all commits made in the repository between 3 days ago and 2 days ago, including the names of the files that were changed in each commit. The output will be similar to the previous example, but without the commit IDs:

file1.txt
file2.txt

file3.txt

file4.txt
file5.txt
Enter fullscreen mode Exit fullscreen mode

In this example, we can see that there were three sets of changes made in the repository between 3 days ago and 2 days ago, and the names of the files that were changed in each set of changes are listed underneath each other. Again, note that the actual file names will vary depending on the repository and the changes that were made.

Top comments (0)