Real cherry picking.
* magit.el (magit-mode-map): Bind it to 'A'. (magit-cherry-pick): New. (magit-apply-item): Use diff and apply instead of cherry-pick so that we can change a unclean work tree.
This commit is contained in:
parent
45bff9c642
commit
45055cdf3e
1 changed files with 8 additions and 1 deletions
9
magit.el
9
magit.el
|
@ -532,6 +532,7 @@ Many Magit faces inherit from this one by default."
|
||||||
(define-key map (kbd "d") 'magit-diff-working-tree)
|
(define-key map (kbd "d") 'magit-diff-working-tree)
|
||||||
(define-key map (kbd "D") 'magit-diff)
|
(define-key map (kbd "D") 'magit-diff)
|
||||||
(define-key map (kbd "a") 'magit-apply-item)
|
(define-key map (kbd "a") 'magit-apply-item)
|
||||||
|
(define-key map (kbd "A") 'magit-cherry-pick)
|
||||||
(define-key map (kbd "v") 'magit-revert-item)
|
(define-key map (kbd "v") 'magit-revert-item)
|
||||||
(define-key map (kbd "x") 'magit-reset-head)
|
(define-key map (kbd "x") 'magit-reset-head)
|
||||||
(define-key map (kbd "X") 'magit-reset-working-tree)
|
(define-key map (kbd "X") 'magit-reset-working-tree)
|
||||||
|
@ -1039,8 +1040,14 @@ Please see the manual for a complete description of Magit.
|
||||||
((commit)
|
((commit)
|
||||||
(magit-append-to-log-edit
|
(magit-append-to-log-edit
|
||||||
(magit-format-commit info "%s%n%n%b%n(Cherrypicked from %H)"))
|
(magit-format-commit info "%s%n%n%b%n(Cherrypicked from %H)"))
|
||||||
(magit-run "git" "cherry-pick" "--no-commit" info))))
|
(magit-run-shell "git diff %s^ %s | git apply -"))))
|
||||||
|
|
||||||
|
(defun magit-cherry-pick ()
|
||||||
|
(interactive)
|
||||||
|
(magit-item-case (item info "apply")
|
||||||
|
((commit)
|
||||||
|
(magit-run "git" "cherry-pick" info))))
|
||||||
|
|
||||||
(defun magit-revert-item ()
|
(defun magit-revert-item ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(magit-item-case (item info "revert")
|
(magit-item-case (item info "revert")
|
||||||
|
|
Loading…
Add table
Reference in a new issue