How to do a Pull Request on a (Microsoft) GitHub repository

Share on facebook
Share on google
Share on twitter
Share on linkedin

I already made a couple of Pull Request on Microsoft Documentation, but at that time I could do everything online within Github because it was only some text changes. Now this time I wanted to alter some binary data (an image in this case). And I had now clue how to do it through the Github portal. I use Azure DevOps all the time and I can do PR’s within the same repo, but I never did one on an external PR.

Now that I know how to do it, I will not forget it anymore, but in case any one else is having issues with it. Here is a short tutorial, since I could not find one quickly online

So it all starts with repository where I do not have writing access to, only read. Which in my case was Azure Machine Learning Workshop material.

I wanted to replace an image within the Media Folder.

Step 1:

Fork the repository to your own GitHub account by clicking the ‘Fork’ button in the right upper corner. Making a ‘Fork‘ means making a copy to an environment where you can experiment and make changes as much as you want.

Step 2:

After making the ‘Fork’ a new repository will be created within your own GitHub Account (usually the same name as the original).

Clone that repository to your computer and open it with your favorite IDE. (In this case I’ll open it with Visual Studio)

Step 3:

Make the changes that you want, alter code, add or remove files, …
Do one 1 issue at a time, you will get why later.

Step 4:

Commit your changes locally. This is the reason of only changing one issue at the time. Because you can group all your changes for 1 issue in 1 commit. You can only give 1 comment per commit. So if you would commit changes to multiple issues at the same time then you would need to list inside your commit comment what change belongs to which issue.

After committing, you can make changes for other issues. With other words you  need to redo step 3 and 4 until you have done everything you want.

Step 5:

Send your changes back to your remote GitHub repository. This can be done by clicking ‘Sync’ and then ‘Push‘. If you wanted to change different issues and you made different commits you will see them in your ‘Outgoing Commits’.

When a Push’ is successful, all your changes are ready to make a pull request.

Step 6:

Go back to the original repository and click on Pull Request in the navigation menu, and click on the button ‘New pull request’

Once you click on ‘compare across forks’ you get drop down boxes that will let you compare different repository branches. In this case we want to compare the base repository with my own fork of the same repository. So in the drop down box you need to choose your own.

After selecting your repo, a comparison will happen between the 2 and you will get a list of changes. If you agree with that. You can click ‘Create pull request’

At this moment you have the chance to add some extra information to your pull request. Depending on the owner of the repository you will need to keep yourself to certain guidelines. Otherwise your PR might not get accepted.

When you are done click ‘Create pull request’

That’s it! Your PR has been created, some checks might happen to see if everything is still ok and if a merge might be possible. Depending from the type of project a ‘build’ of the code might happen.

Now you need to wait for a review by the owners of the repository. If they agree the changes will be merged.

Conclusion

For many people this might be something very easy, and it is actually very easy. But if you have no idea how to start, then it might take you a while to figure it out.

Hope this post helped you! If so, post a comment!

3 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *