git log between closed interval

Asked

Viewed 45 times

0

Receiving an initial date and a final date and I need to get all commits between that interval but the git log interval is open so no commit is on the exact date of the final day and retrieved.

An example is using the following command:

git log  --before=2017-10-09T11:53:52.089+0000 --after=2017-10-04T12:18:34.287+0000

But it uses an open interval that is it does not show the values between days 4 to 9 and yes of days 4 to 8 as can be seen in the following log:

commit d4677be5c080b2ce502c281ab116c1e5a2589047
Author: Rossen Stoyanchev <[email protected]>
Date:   Fri Oct 6 21:29:36 2017 -0400

    Improve Web Servlet section structure

commit 9998c63ee4d4a3987d50c1d4ad8afade6a8b6646
Author: Rossen Stoyanchev <[email protected]>
Date:   Fri Oct 6 13:11:15 2017 -0400

    Compact headings in Web Servlet section

    Optimized for viewing in left TOC.

commit b47905f0507bb204470655d1e1578da53d5a76e1
Merge: 3533db7 fba2633
Author: Stephane Nicoll <[email protected]>
Date:   Fri Oct 6 07:46:18 2017 +0200

    Merge pull request #1549 from WilderPereira:patch-1

    * pr/1549:
      Fix doc format

commit fba2633e6e20d083bf13cb545827b04ba4ff71aa
Author: Wilder Pereira <[email protected]>
Date:   Thu Oct 5 22:43:37 2017 -0300

    Fix doc format

    Closes gh-1549

commit 3533db78d24117d11a598b38a06422a9360faedf
Author: Rossen Stoyanchev <[email protected]>
Date:   Thu Oct 5 23:33:21 2017 -0400

    Fix broken link to overview

commit b11caeb3ea763bf26680ffedba9bde9e740fdf4e
Author: Rossen Stoyanchev <[email protected]>
Date:   Thu Oct 5 22:43:26 2017 -0400

    Fix headings in WebFlux section

commit ee3913c6d0e092ba798fb9fb4fc1d758b8692e36
Author: Rossen Stoyanchev <[email protected]>
Date:   Thu Oct 5 22:23:38 2017 -0400

    Use Tocbot for Table of Contents

commit 8aaa7e9cc7c0618b64be9b052689db39471e6617
Author: Rossen Stoyanchev <[email protected]>
Date:   Thu Oct 5 15:31:27 2017 -0400

    Polish index.html

commit eea8ee2165d694165364692bfd1ad761bb7fc09d
Author: Rossen Stoyanchev <[email protected]>
Date:   Thu Oct 5 14:22:26 2017 -0400

    Migrate JSP tag library appendix reference to Javadoc.

    The Javadoc on tag classes now has all the information including a
    list of all tags at the package level, HTML tables listing tag
    attributes in each tag class, and class level description that is
    as good or in many cases better than what was in the reference.

    Issue: SPR-16045

commit e5a5677fcd2a0948be5ab87fbd418fdc7b2b1daf
Author: Rossen Stoyanchev <[email protected]>
Date:   Thu Oct 5 07:23:18 2017 -0400

    Appendix refactoring

    1. Move schemas to local appendix within each top-level section.
    2. Link to Javadoc for JSP tags
    3. Purge Class Spring usage information

    Issue: SPR-16045

commit d04d4bfb4d4bfabd7cef417d5b45fd992603a18f
Author: Rossen Stoyanchev <[email protected]>
Date:   Wed Oct 4 14:58:11 2017 -0400

    Better "no content" support and polish in WebTestClient

    The WebTestClient now takes advantage of the support for decoding
    response to Void.class in WebClient so that applications can use
    expectBody(Void.class) to the same effect as using
    response.bodyToMono(Void.class) as documneted on WebClient#exchange.

    The top-level, no-arg returnResult method (added very recently) has been
    retracted, since the use of returnResult at that level, i.e. without
    consuming the response content, should be used mainly for streaming.
    It shouldn't be used for "no content" scenarios.

    Documentation and Javadoc have been udpated accordingly.

commit decb6329dba834043d72c44457d997d0409eda4f
Author: Rossen Stoyanchev <[email protected]>
Date:   Wed Oct 4 04:50:11 2017 -0400

    DefaultWebTestClient internal refactoring

    Use the ClientResponse methods bodyToMono and bodyToFlux rather than
    passing in a BodyExtractor so that WebTestclient now also benefits from
    the recently improved handling of Void.class.

Note: Log shows until day 6 because there are no commits on days 7 and 8 but there are commits on day 9.

How can I get commits between this closed interval ?

  • 1

    git log -before=2017-10-10T11:53:52.089+0000 --after=2017-10-04T12:18:34.287+0000 , if default does not show the last day (9), add another day (10). This way he will show the day 9 and will not show the day 10.

  • The dates are picked by request so I don’t know what dates are, so just add more +1 to a date is not useful because the date may be the last day of the month or leap year month.

  • Are you sure this is not the time that you’re getting in the way? How do you get this date?

  • Adding one more really works, thank you

  • 1

    @Jonathandetoni, how would you feel about providing an answer to the question, since you were able to help the AP find the solution? :)

1 answer

0

git log --before=2017-10-10T11:53:52.089+0000 --after=2017-10-04T12:18:34.287+0000

If default does not show the last day (9), add another day (10). This way it will show the day 9 and will not show day 10.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.