似乎我意外地了解到,在这种特殊情况下,确实v绑定了magit-revert-item
,曾经做过magit-discard-item
无节制的大块头。请参阅<=== HERE ===
我在下面发表的评论:
(defun magit-revert-item ()
"Revert the item at point.
The change introduced by the item is reversed in the current
working tree."
(interactive)
(magit-section-action revert (info)
([* unstaged] (magit-discard-item)) ;; <=== HERE ===
(commit (when (or (not magit-revert-item-confirm)
(yes-or-no-p "Revert this commit? "))
(magit-revert-commit info)))
(diff (when (or (not magit-revert-item-confirm)
(yes-or-no-p "Revert this diff? "))
(magit-apply-diff-item it "--reverse")))
(hunk (when (or (not magit-revert-item-confirm)
(yes-or-no-p "Revert this hunk? "))
(magit-apply-hunk-item it "--reverse")))))
来源:1.4.2代码。
但是现在这不会发生:
(defun magit-reverse (&rest args)
"Reverse the change at point in the working tree."
(interactive (and current-prefix-arg (list "--3way")))
(--when-let (magit-current-section)
(pcase (list (magit-diff-type) (magit-diff-scope))
(`(untracked ,_) (user-error "Cannot reverse untracked changes"))
(`(unstaged ,_) (user-error "Cannot reverse unstaged changes"))
(`(,_ list) (magit-reverse-files (magit-section-children it) args))
(`(,_ files) (magit-reverse-files (magit-region-sections) args))
(`(,_ file) (magit-reverse-files (list it) args))
(_ (magit-reverse-apply it args)))))
资料来源:大师:
但是k直接绑定magit-discard-item
。我本来应该学会使用它。在2.1.0之前可以使用,现在仍然可以使用。
总而言之,已对magit 2.1.0进行了重新设计。不可避免的是,有些怪异的极端案例可能无法幸免。而且,我同意,不需要生存。我将重新学习密钥。