Skip to content

Maintenance: PR Clean Up

Anthony Nandaa edited this page Jan 31, 2023 · 8 revisions

Guide for Cleaning up a PR

We have situation where someone opens a PR and they are not able to do some clean-ups before it's landed.

Steps:

  • Make sure your local master is up to date with the origin/master, origin being validatorjs/validator.js
  • Create a remote pointing to the repo where the PR originated from, e.g. for the case of PR#923:
    $ git remote add other [email protected]:odrzutowiec/validator.js.git
    

image

  • Checkout a new branch off master, can name it chore-clean-#<pr-id>
  • Fetch the work from the remote branch (will not always be master, depends on what the author called it), e.g.
     $ git fetch other master
    
  • Merge the fetched branch and fix merge conflicts if any (NB: using -X ours, then add back their work manually, e.g.
    $ git merge other/master -X ours
    
  • Make all the necessary changes, run tests and commit the work.
  • To get the users email address to be used in the Co-authored-by, you can go back to the PR and click on any of their commits: image
    • On the browser's address bar, add .patch on the URL and click enter.
    • You should see details of their email or the privacy-enhanced one by Github in the From: field.
  • In your commit body, remember to add:
    Co-authored-by: name <[email protected]>
    
    closes #<pr-id> #<original-issue-id-if-any>
    
  • Push the new work to your remote (the fork on your GH profile), eg.
    $ git push prof chore-clean-#923
    
  • Go to GH and create a new PR, linking it up with the old PR.
Clone this wiki locally