Oh My GitHub 1.0 is out!
tags: emacs
Table of Contents
I'm glad to announce my package Oh My GitHub v1.0 is out. Besides bug fixes, it introduce a very practical feature: create pull request without leaving Emacs.
AFAIK, there already exists a similar package called github-pullrequest does this job, but its interface is not very flexible, the PR's title and description is hard coded, and this will break template setup by owners if there exists one.
In oh-my-github, M-x omg-pull-create will open an org-mode buffer to edit
what a PR required:
title- the target
repo&branchthat your changes want to be merged into head, the name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace head with a user like this: username:branch.draft, indicates whether the pull request is a draft.
Those are PR's metadata, and users can define following metadata in org-mode buffer to set them:
#+TITLE:
#+TARGET-REPO: ${owner}/${repo}
#+TARGET-BRANCH:
#+SOURCE-HEAD:
#+DRAFT:
And oh-my-github will use context git info to auto fill those fields, for
example
- use last commit message as title
- use current branch as source head
Users can define following directory variables(.dir-locals.el) to
automatically set those when default value doesn't make sense:
((nil . ((omg-pull-target-repo . "jiacai2050/oh-my-github")
(omg-pull-target-branch . "master")
(omg-pull-username . "jiacai2050")
(omg-pull-draft . "false"))))As for description, oh-my-github will detect whether
${project-root}/.github/pull_request_template.md exists, and insert
following block when it's there:
#+begin_export markdown // template's content #+end_export

After finish editing those information, users can C-c C-c to submit it, or C-c C-k
to cancel. If PR is created successfully, oh-my-github will open the PR link via
browse-url-default-browser.
I have used this workflows for a while, and feels very comfortable, and hope you guys will also enjoy this feature just like I enjoy making it!
Why oh-my-github
People may wonder why oh-my-github since there are alternatives(Forge) exist, here are my answer in this Reddit thread:
oh-my-github's Emacs interface require nothing but Emacs(28+), so this maybe its one advantage(or disadvantage 🤔).
All that said, oh-my-github is not only designed for Emacs, it's designed as a generic framework for working with GitHub API.
oh-my-github's core is written in C, so other language may use it as a library via FFI, I plan to improve CLI interface in future.
Hope this explain what oh-my-github's design principle is, and why it exists besides X/Y/Z.