gists/gists/magit-diff-range-current-bu...

8 lines
423 B
EmacsLisp

(defun my/magit-diff-since (&optional since)
"Shows the diff for the current file SINCE the given date/time."
(interactive "sSince (default 24 hours ago): ")
(let* ((revisionA (format "HEAD@{%s}" (or (and (not (string-empty-p since)) since) "24 hours ago")))
(revisionB "{worktree}")
(range (string-join (list revisionA ".." revisionB))))
(magit-diff-range range () (list (buffer-file-name)))))