Can I edit two files then make one commit using GitHub Web-based editor?
Solution 1:
There is a web-based workaround:
- Create a temporary branch, switch to it;
- Edit multiple files, commit each file separately;
- Make pull request;
- Under Merge pull request button, choose Squash and merge (if the repo allows it), then confirm merge;
- 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:
- 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".
- Do not create a Pull Request yet.
-
[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. - 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.
- 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
- 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.