From d943d5ea75b3434b1fb5c82790fc2c6dc0cf6bb0 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 3 Sep 2015 00:55:52 -0400 Subject: Add magit-commit-wip-with-file command --- lisp/init-git.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lisp/init-git.el') diff --git a/lisp/init-git.el b/lisp/init-git.el index 9a803d2..638f591 100644 --- a/lisp/init-git.el +++ b/lisp/init-git.el @@ -82,6 +82,22 @@ CHOOSE-PROJECT is non-nil, prompt for the project name." (t (message "No changes to %s" file))))) +(defun km/magit-commit-wip-with-file () + "Make a WIP commit for the current file. +Unlike `magit-wip-*' commands, this commit is made to the current +branch." + (interactive) + (let ((file (or (buffer-file-name (buffer-base-buffer)) + (user-error "Not visiting file")))) + (cond ((magit-anything-staged-p) + (user-error "There are already staged changes")) + ((member (magit-file-relative-name file) (magit-modified-files)) + (magit-stage-file file) + (magit-run-git "commit" (format "--message=WIP %s" + (magit-file-relative-name file)))) + (t + (message "No changes to %s" file))))) + (defun km/magit-ff-merge-upstream () "Perform fast-forward merge of upstream branch. \n(git merge --no-edit --ff-only )" -- cgit v1.2.3