By koppor
Resolve merge conflicts from squash-merged PRs by creating a merge commit that restores branch history.
Have you ever created a branch based on another branch?
Then that other branch got squash-merged into main.
Now your pull request, which was based on that branch, can’t merge cleanly because Git sees your old commit as conflicting with the squashed commit in main?
This tool generates a special merge commit that links your branch to the squashed history in main, eliminating the conflict and letting you merge main without trouble.
Execute the tool with following command:
jbang do@koppor/magic-merge-commit <pr-number>
<pr-number> is the number of the pull request which was squashed-merged into main.
You need to be on the branch which is based on the pull request indicated by <pr-number>.
To have jbang working, you need to install it. Find information at the jbang page.
If you don't want to install jbang, this repository already ships gg.cmd in its root. Execute as follows:
sh ./gg.cmd jbang do@koppor/magic-merge-commit <pr-number>.\gg.cmd jbang do@koppor/magic-merge-commit <pr-number>This repository is also a Claude Code plugin. Install it so Claude runs the tool for you when it detects a squash-merge conflict:
/plugin marketplace add koppor/magic-merge-commit
/plugin install magic-merge-commit@magic-merge-commit
The skill still requires jbang (or gg.cmd) and a GITHUB_TOKEN environment
variable on your machine — it tells Claude when and how to invoke the tool,
it does not bundle the tool itself.
The pull request starts with one commit.

Another improvement is needed. It should be reviewed separate pull request, but needs the first pull reuqest.
Therefore, a new branch is created and a commit is added to it. Finally, a second pull request is created, based on the first one, which is still opened.

main
main branch has its own commitThe conflicting change in main.

main branchThe second commit in the pull request conflicts with the main branch, which has its own commit.

The first pull request was added as commit to the main branch.
There is no git merge commit and there is no git connect with the pull request.
The only indicator is #1 in the commit message.

This tool creates a new commit that has both main and pr-last-commit as parents.
This commit "magically" resolves the conflict by wiring the two branches together.

This "magic" merge commit now merges cleanly.

gh-cherry-pick is a GitHub CLI extension allowing to gh cherry-pick -pr <pr-number> -onto <target_banch> allows to cherry-pick PRs into unrelated branches.gitk was used to visualize the commits. Learn more about it at lostechies.Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub koppor/magic-merge-commit --plugin magic-merge-commitCompile LaTeX, plain TeX, and ConTeXt documents to PDF using the Island of TeX texlive/texlive Docker image.
Ultra-compressed communication mode. Cuts ~75% of tokens while keeping full technical accuracy by speaking like a caveman.
Frontend design skill for UI/UX implementation
Comprehensive UI/UX design plugin for mobile (iOS, Android, React Native) and web applications with design systems, accessibility, and modern patterns
Memory compression system for Claude Code - persist context across sessions
Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth
Standalone image generation plugin using Nano Banana MCP server. Generates and edits images, icons, diagrams, patterns, and visual assets via Gemini image models. No Gemini CLI dependency required.