From 333e7d0cb71512835899ef6f75f4e3c960a38f67 Mon Sep 17 00:00:00 2001 From: Phil Jackson Date: Wed, 28 Oct 2009 20:13:28 +0000 Subject: [PATCH] Squashable, manual merges. * magit.el (magit-manual-merge): Given a prefix arg, add --squash and remove --no-ff. * magit.texi: Docs for the above. --- magit.el | 13 +++++++++++-- magit.texi | 6 ++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/magit.el b/magit.el index a911950d..d051bd7d 100644 --- a/magit.el +++ b/magit.el @@ -2131,9 +2131,18 @@ in log buffer." (magit-section-info sec)))) (defun magit-manual-merge (rev) - (interactive (list (magit-read-rev "Manually merge" (magit-guess-branch)))) + "Merge (without commiting) REV. Given a prefix-arg then the +merge will be squashed." + (interactive + (list (magit-read-rev (concat "Manually merge" + (when current-prefix-arg + " (squashed)")) + (magit-guess-branch)))) (if rev - (magit-run-git "merge" "--no-ff" "--no-commit" + (magit-run-git "merge" "--no-commit" + (if current-prefix-arg + "--squash" + "--no-ff") (magit-rev-to-git rev)))) (defun magit-automatic-merge (rev) diff --git a/magit.texi b/magit.texi index 7fa1b500..83f88ceb 100644 --- a/magit.texi +++ b/magit.texi @@ -498,9 +498,11 @@ Type @kbd{m} to initiate a manual merge, and type @kbd{M} for a automatic merge. A manual merge is useful when carefully merging a new feature that you -want to review and test before even committing it. A automatic merge +want to review and test before even committing it. An automatic merge is appropriate when you are on a feature branch and want to catch up -with the master, say. +with the master, say. If you would like to squash the merge (have git +avoid creating a merge commit) then use a prefix argument with the +command (@kbd{C-U m}). After initiating a manual merge, the header of the status buffer will remind you that the next commit will be a merge commit (with more than