>From the git-merge(1) man page:
#+begin_quote
*Warning*: Running 'git merge' with non-trivial uncommitted changes
is discouraged: while possible, it may leave you in a state that is
hard to back out of in the case of a conflict.
#+end_quote
Signed-off-by: Pieter Praet <[email protected]>
---
magit.el | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/magit.el b/magit.el
index 994e430..bfbd730 100644
--- a/magit.el
+++ b/magit.el
@@ -4567,10 +4567,22 @@ (defun magit-remove-conflicts (alist)
;;; Acting (1)
;;;; Merging
+(defcustom magit-merge-warn-dirty-worktree t
+ "Whether to issue a warning when attempting to start a merge in a dirty
worktree."
+ :group 'magit
+ :type 'boolean
+ :package-version '(magit . "1.3.0"))
+
+(defun magit-merge-check-clean ()
+ (or (magit-everything-clean-p)
+ (not magit-merge-warn-dirty-worktree)
+ (yes-or-no-p "Running merge in a dirty worktree could cause data loss.
Continue?")))
+
(defun magit-merge (revision &optional do-commit)
"Merge REVISION into the current 'HEAD'; leave changes uncommitted.
\('git merge --no-commit REVISION')."
- (interactive (list (magit-read-rev "Merge" (magit-guess-branch))
+ (interactive (list (when (magit-merge-check-clean)
+ (magit-read-rev "Merge" (magit-guess-branch)))
current-prefix-arg))
(when revision
(apply 'magit-run-git
--
1.7.11.1
--
---
You received this message because you are subscribed to the Google Groups
"magit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.