diff options
| author | jao <jao@gnu.org> | 2026-08-31 09:36:35 +0100 |
|---|---|---|
| committer | jao <jao@gnu.org> | 2026-08-31 09:37:07 +0100 |
| commit | 3664998a06b94dc86085e29185a45b400cfd4226 (patch) | |
| tree | 204c4bcfb03d1b0cf628f352cb6963d44b4f1628 | |
| parent | b87794e281aa198a95842a3cecf29c908c3eb15f (diff) | |
| download | elibs-3664998a06b94dc86085e29185a45b400cfd4226.tar.gz elibs-3664998a06b94dc86085e29185a45b400cfd4226.tar.bz2 | |
forge: create branch from issue
| -rw-r--r-- | init.el | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -1681,6 +1681,23 @@ :config :bind ((:map forge-topic-mode-map ("M-w" . copy-region-as-kill)))) +(defun jao-forge-create-branch-from-issue () + "Create and checkout a git branch named after the Forge issue at point." + (interactive) + (let* ((topic (or (forge-current-topic) (user-error "No issue at point"))) + (id (oref topic number)) + (title (oref topic title)) + ;; Clean up the title to make it a valid git branch name + (clean-title (downcase (replace-regexp-in-string "[^a-zA-Z0-9]+" "-" title))) + (branch-name (format "jao-%d-%s" id (string-trim clean-title "-"))) + (branch-name (read-string "Create branch: " branch-name))) + (magit-branch-and-checkout branch-name (magit-get-current-branch)))) + +;; Optional: Bind it to 'b i' inside Magit status/issue buffers +(with-eval-after-load 'magit + (transient-insert-suffix 'magit-branch "s" + '("i" "branch from issue" jao-forge-create-branch-from-issue))) + ;;;; forgejo (use-package forgejo :ensure t |
