Or just all the commits that occurred between two dates? In SVN, you could do something like
svn diff -r{date}:{date}
to do it! I can't seem to find a Git equivalent to this.
Specifically I'm looking at writing a script to send out daily emails with all the code committed that day and by who.
Perhaps
is what you want (with or without '--stdout')?
or
Another simple way that you can get a diff of all changes since a certain date is to simply find the first commit
X
that occured on or after that date, then useThis has the advantage that it doesn't depend on reflog entries in a fresh clone, unlike the
solutions in
"date" is a bit of a loose concept in git. A commit will have an author date that may be some time well in the past before someone actually pulls/commits the commit into their repository, also the commit may be rebased and updated to be on top of an apparently newer commit.
A commit also has an commit date which is updated if a commit is rebased or amended in any way. These commits are more likely to be in some sort of chronological order but you are still at the mercy of the committer having the correct time set on his computer and even so, an unmodified commit can sit on a feature branch on a remote repository indefinitely before being merged into the master branch of a central repository.
What is probably most useful for your purposes is the reflog date on the particular repository in question. If you have per-branch reflogs enabled (see
git config core.logAllRefUpdates
) then you can use theref@{date}
syntax to refer to where a branch was at a particular time.E.g.
You can also use 'fuzzy' descriptions like:
These commands will show all commits that have 'appeared' in the given branch of the repository regardless of how 'old' they actually are according to their author and commit dates.
Note that the per-branch reflog is specific to a repository, so if you're running the log command on a clone, and you don't pull for (say) a month then pull all the changes for the last month at once, then all of the last month's changes will appear in a
@{1 hour ago}..@{now}
range. If you are able to run the log command on the 'central' repostory that people push to, then it may do what you want.You can also use git-format-patch to prepare patches (diffs) and send them through email.
Use options [since] or [revision range] to specify commits range.
You could use
git whatchanged --since="1 day ago" -p
It also takes a
--until
argument.Docs