How to split a file in a PR and keep the comments

Viewed 24

I've submitted a PR from my fork to the main project on github. It is simply a text file (a specification). It has received many comments, including ones saying that it ought to be two separate documents.

Is there any way I can split it into two parts (the top half and the bottom half) such that both halves keep their comments?

1 Answers

What you can do is to simply fix all change requests in this single file, then do two things:

  • commit changes with a message like "Fixup: address comments". Note that this could be multiple commits if your change requests are logically organized into different ideas. For example, formatting WORKING code with a formatter is different from fixing a bug detected in code well formatted. In this case it's useful for your reviewers to split the fixup commits into unit changes as you amend your code.

  • split the edited file into two files and commit the changes with a message like "Fixup: split File into File1 and File2"

Then, if the reviewers are happy with the changes, you can squash everything into a single commit that contains both files, or reset the history and add one commit per each file.

Related