Occassionally, I find a PR in the core issue queue that is near completion, but the origional author of the PR is unavailable at the time. I just need a copy of their PR that I can work on.
If the author of the PR is available and active in the issue queue, I would contact them first and let them know what I'm planning to do. But, assuming they are not available or have previously made it clear that anyone should feel free to take over or work on their PR's in their absense, I will go ahead and create a copy/fork of their PR. (I'm stating now, that anyone should feel free to fork any of my core PR's at any time and work on them if they choose.)
How to fork a PR in the core issue queue:
I'm a bit embarassed to say, that in the past I have actually created new branches in my fork of Backdrop and cut and pasted the changes, one by one, from the original PR into my branch. This has not been a huge problem, because I've limited this to PR's that are not very complicated.
I knew that there must be a better way and today I took the 10 minutes necessary to research it and try it out. Why didn't I do this sooner?
Documenting what I learned here, for future me (and anyone else who might be interested).
1. Fork the Backdrop Repository
Navigate to the Original Repo: Visit the repository where the PR was created.
Click “Fork”: This creates your own copy of the repo in your GitHub account.
2. Clone Your Fork of Backdrop Locally
git clone https://github.com/yourusername/repo.git
3. Add the Backdrop Repository as a Remote
To keep your fork in sync with the original repo:
git remote add upstream https://github.com/backdrop/backdrop.git
Make sure that your local version of Backdrop is up to date.
4. Fetch the PR Branch from Backdrop repo
GitHub doesn’t automatically sync PR branches, so you need to fetch it manually:
git fetch upstream pull/PR_NUMBER/head:branch_name
Replace PR_NUMBER with the actual PR number and branch_name with whatever you want to call it.
5. Checkout the new Branch
git checkout branch_name
You may need to rebase branch with main dev branch 1.x.
6. Make Your Changes
Edit the files as needed.
7. Commit and Push
Commit and push changes to your fork of Backdrop CMS - in the manner you are used to.
8. Create Your Pull Request
Go to Your Fork on GitHub.
Compare Pull Request: Select your new branch and create a PR back to the original repo (or your fork if that's your goal).
As with most things in GIT, there are other ways of accomplishing the same thing.
GITHUB CLI
I've just been informed that GITHUB CLI is another set of commands specific to the GITHUB platform and that it has some commands that could be useful in this workflow. This is too much new stuff for me in one day, let's come back to this topic later.
Feel free to go down this path on your own at: https://cli.github.com/manual/