Volume XXII, number 279Tuesday, October 6, 2026Latest message 58 minutes ago

The Git List

News and archive of git@vger.kernel.org, since April 2005

Solution searched how to rebase/merge an existing commit to the reference of an Github PR

1 messages between Sep 5, 2026 and Sep 5, 2026, from Erdhoernchen.

Plain Markdown or JSON for tools and agents.

ErdhoernchenSep 5, 2026, 20:26 UTC on lore
Hello to all,
I hope, that this list is the right place for my question.
I have set up a 3-Layer Git infrastructure, with Github as the topmost repository.

Below is a local dispatch-repository from where I will pull PRs from Github and push all local changes up to github. No code changes are done here, this is transitory only.

The lowest tier is the development repository, where daily changes are happening. Here I have several branches for new functionality or some older code as reference.

As the main branch is a high volume repo, with autocommit on succesful compiles there is a separate branch for pushing fixes and new functions to. This is an orphan branch, which gets updated from time to time, when new functions or fixes should be deployed to the upper repos. Here I create the commits, which should be finally arrive in Github. Using Conventional Commits Information about what the commit is good for, is included. This works already perfect. Once a new version or a fix should be deployed, all changed files are checked out into the release repo, and a single new commit is issued.

This branch gets pulled from dispatch-repository and from there it will be pushed to Github.

So this direction is works just perfect. 
My problem are now PRs coming from Github.

My workflow is here the following: From the dispatch-repo I pull a patchfile with all changes from the PR and store this patchfile in a directory, which can be accessed by the development repo. In the development repo I use the patchfile to make the needed changes and bring them to a new commit in the release branch.

This commit has no reference to the Github-PR besides the information in the commit message: "fix: merged (#123) to solve ...."

Now I need a way, to integrated this release commit into the dispatch-repository and finally to Github with just a single commit. I need to integrate it in the PR branch, I have fetched with:

`-git fetch origin +refs/pull/*/head:refs/heads/pr/*`

How can I make a three way merge or a rebase, so that the PR in the pr/xxx branch is used as the reference for Github, to close the PR as solved and merged, even when my local repository is some commits ahead to the PR.

This is the usual situation, but I my goal is, to get this done in one single commit, which has the ID from my development:release branch, so that the next commit from there, will fit into the chain, without the need to merge ghost commits back.

So the picture looks like:
          +------------------+
-->PR/x-> |   GitHub         |
          +------------------+
             |        ^  ^
             |        |  |
             v        |  +----how to manage this
          +------------------+    ??????           << here is my problem
          | Dispatch  |      |-->pr/x branch
          +------------------+           ^
             |        ^                  |
       patchfile x    |                  |
             |     new version<---+      |
             v                    |      |
          +------------------+    |      |
   main <-|  development     |--> release branch
          +------------------+          
            |   |   |
            v   v   v
            different
            development 
            branches

The direction from release for new versions/fixes not releated to an PR are working flawless! Only the direction, how I can handle the commit from release, so that is based on the PR that Github will merge and close the PR is my problem. My goal is, to solve this in my repo without media disruption, by changing for single actions to the Browser window.

Thanks for useful hints. My goal is, to solve this with pure git functionality without gh or other helpers.

If this is not the right list for such questions, I would be very glad, to get some informations, where I can discuss this problem with real git experts/enthusiats.

Kind regards
  e.

Back to recent threads