Care and keeping of pull requests, part i

29 Jun 2015

See first post disclaimer

Scenario: You want to submit some changes to the master repository, owned by someone else. You can’t submit them directly, so you have to create a pull request.

In what follows, master is the main branch of development. In our local repository, we have used origin to refer to the central repository, and peach refers to your fork of the central repository.

Submitting a pull request

First, create a new branch for the changes and check it out. This can be done with two commands:

$ git branch banana-peels
$ git checkout banana-peels

or with one:

$ git checkout -b banana-peels

After changes are made and committed (with the usual git add + git commit combination), you can push the branch with your changes to your remote (peach):

$ git push peach banana-peels

This puts changes online in your (peach’s) copy of the repository. Now you just need to notify the central repository (origin) by actually submitting the pull request (literally - “I’m requesting that you pull the changes from my copy”). [1]

You can always submit a pull request by 1) going to your online remote (so github.com/peach/our-repository) 2) clicking on “pull requests” in the right hand menu 3) clicking on the “New Pull Request” button 4) This should land you on a screen that says “Comparing Changes” at the top.

There are other ways to get to this screen (I never submit a pull request the same way on the Github website), but the above will always work. [2] Anyhow, once you’ve clicked some combination of the right buttons, and see “Comparing Changes”, make sure you have the following:

Click on the big green button (two times) to finally submit the pull request. [3]

Updating a pull request with more changes

This is super easy. Go back to the local repository you have on my computer. Make sure you’re in the correct branch (the one we were making changes in before)…

$ git checkout banana-peels

…and make edits/commit changes as before. Push your branch to your fork…

$ git push peach banana-peels

Ta-da! That’s it. You don’t need to “resubmit” the pull request, as the pull request on the main repository will automatically update (Github magic!) based on the changes that you’ve pushed to your copy of the repository.

[1] One thing I found confusing when I started making pull requests was that the changes were in my remote repository, but the pull request appeared on the site for the main repository. Just a heads up.

[2] When in doubt, look for green buttons - they usually signify some way to submit a pull request.

[3]Green buttons everywhere.

how-to » git, collaboration, care and keeping of prs,


Recent Posts

Archive

Categories

Popular Tags

ACT (2) RCF (6) Software Carpentry (6) books (3) care and keeping of prs (6) collaboration (9) computing (13) culture (10) empowerment (6) family (2) gender (2) git (9) hope (2) language (3) lessons (4) math (8) mental health (2) movies (2) personal (5) problem solving (3) programming (9) science (2) self care (3) shell (2) teaching (11) true story (5) tutoring (2) work (12)