path: root/mailscripts.el
diff options
authorSean Whitton <>2020-05-01 11:51:32 -0700
committerSean Whitton <>2020-05-01 12:04:04 -0700
commit238b98bc4245783134b30cbb2918a95d19dacee6 (patch)
treea633aa51604e98bd0b41549b8ca53093f3596422 /mailscripts.el
parentf343a4e23e11ae97e6354ca9c4f91a60a0ea6563 (diff)
mailscripts.el: Add mailscripts-detach-head-from-existing-branch
Signed-off-by: Sean Whitton <>
Diffstat (limited to 'mailscripts.el')
1 files changed, 14 insertions, 1 deletions
diff --git a/mailscripts.el b/mailscripts.el
index 904a30a..6fc8c69 100644
--- a/mailscripts.el
+++ b/mailscripts.el
@@ -34,6 +34,17 @@ E.g. `email/'."
:type 'string
:group 'mailscripts)
+(defcustom mailscripts-detach-head-from-existing-branch nil
+ "Whether to detach HEAD before applying patches to an existing branch.
+This is useful if you want to manually review the result of
+applying patches before updating any of your existing branches,
+or for quick, ad hoc testing of a patch series.
+Note that this does not prevent the creation of new branches."
+ :type 'boolean
+ :group 'mailscripts)
(defun notmuch-slurp-debbug (bug &optional no-open)
"Slurp Debian bug with bug number BUG and open the thread in notmuch.
@@ -131,7 +142,9 @@ git-format-patch(1)."
(mailscripts--projectile-repo-and-branch 'notmuch-extract-message-patches))
(defun mailscripts--check-out-branch (branch)
- (unless (string= branch "")
+ (if (string= branch "")
+ (when mailscripts-detach-head-from-existing-branch
+ (call-process-shell-command "git checkout --detach"))
(format "git checkout -b %s"