Can I edit two files then make one commit using GitHub Web-based editor?

Solution 1:

There is a web-based workaround:

  1. Create a temporary branch, switch to it;
  2. Edit multiple files, commit each file separately;
  3. Make pull request;
  4. Under Merge pull request button, choose Squash and merge (if the repo allows it), then confirm merge;
  5. Delete temporary branch.

I use this method on a PC which I don't want to install git on.

Solution 2:

Yes there is a way to edit 2 files, when you've already edited your first file in the web browser view of GitHub. It's based on the instructions here:

https://webapps.stackexchange.com/questions/95940/how-can-i-change-multiple-files-and-submit-them-in-one-pull-request-on-github

The summary and clarified steps are:

  1. Edit your first file, by clicking the Edit icon in another user's repository. Save this edit in your first commit. GitHub will automatically create a new branch/fork for you, like "patch-1".
  2. Do not create a Pull Request yet.
  3. [This part is the most difficult, because it's not obvious] Go to the list of repositories in your profile, at github.com ➔ click icon at top-right ➔ Your Repositories. Then go to the forked repository that you've just made, and switch to the "patch-1" branch.
  4. Continue making changes to another file, and commit it to your "patch-1" branch. When you are done, click the "Pull Requests" tab near the top, then click Compare & Pull Request or Create Pull Request. You should see your 2 commits in this Pull Request.
  5. If you don't see a "Create Pull Request" button, open a URL like this in your web browser: https://github.com/TargetPerson/TargetGitRepo/compare/master...MyGithubUsername:patch-1
  6. This will show a view to compare your changes to the original target branch in the other user's repository. Then press the Create Pull Request button.