GitHub – How to Change Multiple Files and Submit in One Pull Request

github

I used GitHub's web interface to commit changes to multiple files. For each file, a new pull request has been created:

Pull request example

Does the web interface allow to merge multiple requests so that I can submit all changes in just one request?

Best Answer

If you don't want to think about branches, do the following:

  1. Fork the repository using the Fork button.

fork

  1. Make your changes to your fork (there will be a commit for each file changed, made by default to the master branch).

  2. When you're done, create a pull request using the button "Compare and pull request". The user will get one PR with several commits in it, which is not unusual. They will be able to review all changes at once.


If you want to think about branches... generally, one doesn't commit provisional changes directly to master branch, so that changes can be disregarded easily by deleting the branch. This is why GitHub automatically creates a branch such as patch-1 in your forked repository when you try to edit a file that you can't edit directly.

You can create a "patch" branch yourself, in the forked repository. Or you can take advantage of GitHub's automatic branching and keep the commits in one pull request as follows.

  1. Make the first change by using the edit icon in another user's repository. This creates a fork of repository, and in it a branch such as patch-1. Do not create pull request yet.
  2. Go to the list of repositories in your profile, go to the forked repository you've just made, and switch to patch-1 branch. Continue making changes. When you are done, click "Compare & pull request".