Function: magit-log-move-to-parent

magit-log-move-to-parent is an autoloaded, interactive and byte-compiled function defined in magit-log.el.

Signature

(magit-log-move-to-parent &optional N)

Documentation

Move to the Nth parent of the current commit.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-log.el
;;;###autoload
(defun magit-log-move-to-parent (&optional n)
  "Move to the Nth parent of the current commit."
  (interactive "p")
  (when (and (derived-mode-p 'magit-log-mode)
             (magit-section-match 'commit))
    (let* ((section (magit-current-section))
           (parent-rev (format "%s^%s" (oref section value) (or n 1))))
      (if-let ((parent-hash (magit-rev-parse "--short" parent-rev)))
          (if-let ((parent (seq-find (##equal (oref % value) parent-hash)
                                     (magit-section-siblings section 'next))))
              (magit-section-goto parent)
            (user-error
             (substitute-command-keys
              (concat "Parent " parent-hash " not found.  Try typing "
                      "\\[magit-log-double-commit-limit] first"))))
        (user-error "Parent %s does not exist" parent-rev)))))