Skip to content

Instantly share code, notes, and snippets.

@suhailshergill
Created July 18, 2012 02:59
Show Gist options
  • Save suhailshergill/3133855 to your computer and use it in GitHub Desktop.
Save suhailshergill/3133855 to your computer and use it in GitHub Desktop.
magit: commit labels
(defun su/magit/commit-message-template (&rest discard)
"Have a template for the commit message"
(unless current-prefix-arg ;; ignore commit amends
(let ((tag (format "%s: " (magit-get-current-branch))))
(goto-char (point-min))
(unless (search-forward tag nil t)
(insert tag))
(goto-char (point-max))
)))
(add-hook 'magit-log-edit-mode-hook 'su/magit/commit-message-template)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment