For the git / GitLab geeks of you, the following will be self-explaining and not worth a blog entry, but as I run into this again and again all few weeks, this is a note to myself and others.
How to rebase an issue fork / merge request (MR) locally, if GitLab's "Merge" button isn't available and says you need to rebase manually:
Note: This is only ONE possible way to solve this, not the only one!
General note: prefer the Drupal.org documentation over my one :)
1. Clone the origin project using the "Version control" tab on the Drupal project (we'll use webform here), e.g. https://www.drupal.org/project/webform/git-instructions
- git clone https://git.drupalcode.org/project/webform.git
- cd webform
2. Add & fetch the issue forks repository using "Show commands" on the issue page, e.g. https://www.drupal.org/project/webform/issues/3293182
- git remote add webform-3293182 email@example.com:issue/webform-3293182.git
- git fetch webform-3293182
3. Checkout the issue forks branch using "Show commands" on the issue page, e.g. https://www.drupal.org/project/webform/issues/3293182
git checkout -b '3293182-deprecated-function-pregmatch' --track webform-3293182/'3293182-deprecated-function-pregmatch'
4. Merge the origin project into the issue fork so that the upstream changes (commits) in the module main branch get applied on the issue fork.
git merge origin webform-3293182
5. Solve possible conflicts if git shows any.
6. Push your changes to the issue fork:
Now your issue fork is ready for merge! :)
I hope, this helped you when having potential trouble with manually rebasing a Drupal Issue Fork Merge Request! :)
For details, this discussion is also helpful: https://stackoverflow.com/questions/34118404/what-i-can-do-to-resolve-1…
At this core merge request: https://git.drupalcode.org/project/drupal/-/merge_requests/1505 I tried something different.
The feature branch was 631 commits behind the Drupal Core 9.4.x target branch.
First, I cloned the merge requests feature branch:
- git fetch " firstname.lastname@example.org :issue/drupal-3008924.git" '3008924-callers-of-layoutentityhelpertraitgetentitysections'
- git checkout -b 'issue/drupal-3008924-3008924-callers-of-layoutentityhelpertraitgetentitysections' FETCH_HEAD
Then I added the Drupal Core target branch:
git remote add target email@example.com:project/drupal.git
Then I fetched the target branch and rebased the issue fork branch on it:
- git fetch target
- git rebase target/9.4.x
afterwards I pushed the rebase:
In some cases, where you're not working on the target / base branch, this might be easier and more lightweight.