Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mbriggs
Created December 14, 2012 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbriggs/4288243 to your computer and use it in GitHub Desktop.
Save mbriggs/4288243 to your computer and use it in GitHub Desktop.
(add-hook 'magit-log-edit-mode-hook 'insert-ticket-number-from-branch-name)
(defun insert-ticket-number-from-branch-name ()
(erase-buffer)
(evil-insert-state)
(let* ((current-branch (car (vc-git-branches)))
(ticket-number (replace-regexp-in-string "[0-9]+\\(_.*\\)$" ""
current-branch nil nil 1)))
(when (string-match "^[0-9]" current-branch)
(insert (concat "#" ticket-number ": ")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment