View a file's history in Magit?

前端 未结 5 1361
孤城傲影
孤城傲影 2021-01-30 01:18

View the change history of a file using Git versioning talks about other ways of viewing history of a file in Git.

Can it be done in Emacs Magit?

5条回答
  •  天涯浪人
    2021-01-30 02:11

    If magit (user manual) doesn't have that feature, then you can have a look at other Emacs mode, and add you own git-log-file function:

    (defun git-log-file ()
      "Display a log of changes to the marked file(s)."
      (interactive)
      (let* ((files (git-marked-files))
             (buffer (apply #'git-run-command-buffer "*git-log*" "git-rev-list" \
    "--pretty" "HEAD" "--" (git-get-filenames files))))  (with-current-buffer buffer
          ; (git-log-mode)  FIXME: implement log mode
          (goto-char (point-min))
          (setq buffer-read-only t))
        (display-buffer buffer)))
    

提交回复
热议问题