tj / tj/git-extras

`git pr -m` uses an undocumented and sometimes broken feature of GitHub

Open
#775 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Shell
Stars
18.1k
Forks
1.2k
Avg merge
5d 17h
Merged PRs (30d)
1

Description

According to
https://discourse.drone.io/t/github-claims-that-merge-refs-are-undocumented-feature/1100

The /merge refs are created only to check the mergeability. If a branch is already merged, the ref will be deleted. If no one visits the pull request page or uses the API to trigger the mergeability check, the ref will not update.

Although we could manually trigger the ref rebuild via visit the pull request web page, it would be better to find an alternative way. Maybe we could find the branch targeted by the pull request via GitHub API, and do the merge locally?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the git pr -m command and how it relies on GitHub /merge refs. Read the linked Drone discussion, then investigate the GitHub API path for finding the pull request's target branch and compare it with a local merge. Done means the command no longer depends on the undocumented ref behavior and still handles already-merged branches.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, shell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.