5

Is there by any chance a more concise command to get commits for a specific date than for example the expression below?

git log --after="2014-09-02 00:00:00" --before="2014-09-02 23:59:59"

2 Answers 2

8

You can create an alias.

git config --global alias.logondate '!f() { git log --after "$1 00:00:00" --before "$1 23:59:59"; }; f'

Than you can use it

git logondate 2014-09-02

You should also read Haacked's blog post about git aliases. It contains a lot of useful examples.

2
  • 2
    Better adding --global so that the command is not restricted to the repository you're in. Sep 5, 2014 at 10:46
  • 1
    @Raffael this command places a line in a .gitconfig file under [alias] section. So it is already persisted. See git.wiki.kernel.org/index.php/Aliases#Aliases.
    – filhit
    Sep 5, 2014 at 11:51
0

Sure, you can use unix timestamps, these are a bit shorter :)

git log --after=1409608800 --before=1409695199
1
  • 3
    O_o very concise indeed Sep 5, 2014 at 10:33

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.