How do I make changes to an existing Pull Request against core. I'm assuming that I do the following:

  1. Fork the Backdrop CMS repo (an existing fork) that was used to generate the PR. 
  2. Copy the branch with the PR
  3. Make changes on the PR branch
  4. Create a PR against the original fork and branch

Do I have this correct?

Accepted answer

OK, after consultation with the core dev team. I've been advised that a slightly better option (does not require another user to approve my changes to their PR before core committer is able to see them) is to create a new Pull Request based upon the previous Pull Request by user_x.

  1. Fork the core repository and clone it locally
  2. Add the user_x fork of core as an additional remote to my own local repo.
  3. Pull the PR branch from user_x fork of core to my own local repo
  4. Make my changes locally to the branch
  5. Push the PR branch back to my own fork of core on Github
  6. Generate a new Pull Request in my Github fork of core against actual core 1.x

This blog post was helpful - https://tighten.co/blog/adding-commits-to-a-pull-request

Comments

OK, after consultation with the core dev team. I've been advised that a slightly better option (does not require another user to approve my changes to their PR before core committer is able to see them) is to create a new Pull Request based upon the previous Pull Request by user_x.

  1. Fork the core repository and clone it locally
  2. Add the user_x fork of core as an additional remote to my own local repo.
  3. Pull the PR branch from user_x fork of core to my own local repo
  4. Make my changes locally to the branch
  5. Push the PR branch back to my own fork of core on Github
  6. Generate a new Pull Request in my Github fork of core against actual core 1.x

This blog post was helpful - https://tighten.co/blog/adding-commits-to-a-pull-request

klonos's picture

Here's what I do from the command line (this is actually from a script on my local)...

Lets say that I plan to work on GitLab issue 1234 and the number of the PR the other person has filed against the offical backdrop repo is 567. Following along, all you'd have to do is change those two numbers to the ones corresponding to the issue and PR you need to work with...

Create a directory with the name of the issue I want to work with, and cd into it:

mkdir 1234
cd 1234

Then clone the backdrop repo (not my own forked repo - this allows me to not have to worry about updating my fork) into a docroot directory, and cd into it:

git clone https://github.com/backdrop/backdrop docroot
cd docroot

Add my fork as a remote:

git remote add klonos https://github.com/klonos/backdrop

Create a new branch based on the issue number I plan to work on:

git checkout -b issue-1234

Pull the changes from the other person's PR into the new branch I created earlier:

git fetch origin pull/567/head:issue-1234

...code ...code ...code ...dev ...dev ...dev, then when done I add the changes and commit:

git add .
git commit -m "Issue 1234: Fixing thing abc and adding feature xyz."

I then push the changes to a new branch on my fork:

git push -u klonos issue-1234

...and finally Head over to GitHub to create a PR (GitHub is usually smart enough to know that I just pushed a new branch, and it shows me a message at the top-right to create a OR agains the official Backdrop repo).