In git, how can I get the diff between two dates?

Posted by Weidenrinde on Stack Overflow See other posts from Stack Overflow or by Weidenrinde
Published on 2010-03-16T14:49:03Z Indexed on 2010/03/16 14:51 UTC
Read the original article Hit count: 393

Filed under:
|
|

Basically, I am looking for something equivalent to cvs diff -D"1 day ago" -D"2010-02-29 11:11". While collecting more and more information, I found a solution. I paste it here, for others that might have similar problems.

Things I have tried:

  • In git, how can I get the diff between all the commits that occured between two dates? was ansered here with: git whatchanged --since="1 day ago" -p

    But this gives a diff for each commit, even if there are multiple commits in one file. I know that "date" is a bit of a loose concept in git, I thought there must be some way to do this.

  • git diff 'master@{1 day ago}..master gives some warning warning: Log for 'master' only goes back to Tue, 16 Mar 2010 14:17:32 +0100. and does not show old diffs.

  • git format-patch --since=yesterday --stdout does not give anything.

  • revs=$(git log --pretty="format:%H" --since="1 day ago");git diff $(echo "$revs"|tail -n1) $(echo "$revs"|head -n1) works somehow, but seems complicated and does not restrict to the current branch.

  • git diff $(git rev-list -n1 --before="1 day ago" master) seems to work and a default way to do similar things, although more complicated than I thought.

Funnily, git-cvsserver does not support "cvs diff -D" (without that it is documented somewhere).

© Stack Overflow or respective owner

Related posts about git

Related posts about diff