WEBVTT 99:59:59.999 --> 99:59:59.999 Pull requests are a core part 99:59:59.999 --> 99:59:59.999 of making a change to any GitHub repository. 99:59:59.999 --> 99:59:59.999 Let's figure out how to use them effectively. 99:59:59.999 --> 99:59:59.999 (smooth music) 99:59:59.999 --> 99:59:59.999 Pull requests are a means 99:59:59.999 --> 99:59:59.999 of submitting a change to another code base. 99:59:59.999 --> 99:59:59.999 You can do this whether you're a core contributor, 99:59:59.999 --> 99:59:59.999 or you're working at arm's length with a fork. 99:59:59.999 --> 99:59:59.999 If you're not a core contributor, you can fork this project, 99:59:59.999 --> 99:59:59.999 work on that change on your own 99:59:59.999 --> 99:59:59.999 and send that change back as a proposal 99:59:59.999 --> 99:59:59.999 on a pull request to the original author. 99:59:59.999 --> 99:59:59.999 It means that making a correction becomes easier than making a complaint, 99:59:59.999 --> 99:59:59.999 which is why GitHub has really facilitated the growth and development of Open Source. 99:59:59.999 --> 99:59:59.999 Just make that edit, make it better, 99:59:59.999 --> 99:59:59.999 everyone benefits. 99:59:59.999 --> 99:59:59.999 This also applies to closed projects, corporate projects, private repos. 99:59:59.999 --> 99:59:59.999 If you do have access to push to a repository, 99:59:59.999 --> 99:59:59.999 you should still work on a branch and send that pull request 99:59:59.999 --> 99:59:59.999 to get some review on your code. 99:59:59.999 --> 99:59:59.999 This means you're going to create a branch, 99:59:59.999 --> 99:59:59.999 start making some commits, and when you're ready to get it reviewed, 99:59:59.999 --> 99:59:59.999 send that back to everyone else on your team in that pull request. 99:59:59.999 --> 99:59:59.999 This means that a pull request is a conversation, 99:59:59.999 --> 99:59:59.999 not just a one-shot submission of what's on a branch, 99:59:59.999 --> 99:59:59.999 but rather, a little bit of dialogue and discussion, 99:59:59.999 --> 99:59:59.999 some revision to the code, that all appears in chronological order, 99:59:59.999 --> 99:59:59.999 and finally, an approval, or in the terrible case, 99:59:59.999 --> 99:59:59.999 a thumbs down that says, "this does not seem like a wise change to the code base." 99:59:59.999 --> 99:59:59.999 But in either of those two situations, the URL and the pull request lives on. 99:59:59.999 --> 99:59:59.999 You don't have to stop talking 99:59:59.999 --> 99:59:59.999 just because things were closed out and not accepted. 99:59:59.999 --> 99:59:59.999 You can continue to find out why it wasn't accepted 99:59:59.999 --> 99:59:59.999 and what changes you can make in the future 99:59:59.999 --> 99:59:59.999 to make sure all your pull requests will be accepted. 99:59:59.999 --> 99:59:59.999 This also serves as an educational tool 99:59:59.999 --> 99:59:59.999 for people who join the team at a later time. 99:59:59.999 --> 99:59:59.999 These pull requests are dialogues of what type of change 99:59:59.999 --> 99:59:59.999 might be culturally acceptable here, 99:59:59.999 --> 99:59:59.999 what are the expectations, requirements, formats 99:59:59.999 --> 99:59:59.999 that people expect stuff in, 99:59:59.999 --> 99:59:59.999 and you can save these URLs and point to them as educational tools 99:59:59.999 --> 99:59:59.999 for these new individuals. 99:59:59.999 --> 99:59:59.999 This means you don't have to forward on some email conversation 99:59:59.999 --> 99:59:59.999 about how a feature came to be. 99:59:59.999 --> 99:59:59.999 You can just point someone to a URL and they can look at it for all time. 99:59:59.999 --> 99:59:59.999 We're also interested in the technical inputs, 99:59:59.999 --> 99:59:59.999 not just the human ones. 99:59:59.999 --> 99:59:59.999 A CI system, continuous integration, 99:59:59.999 --> 99:59:59.999 like Travis, Hudson, Jenkins, Circle CI, Team City, 99:59:59.999 --> 99:59:59.999 can all integrate with a GitHub pull request 99:59:59.999 --> 99:59:59.999 and report the build status for this branch, 99:59:59.999 --> 99:59:59.999 the fundamental unit of a pull request, 99:59:59.999 --> 99:59:59.999 right in the line with that conversation. 99:59:59.999 --> 99:59:59.999 So that means along with the conversation and the changes to code, 99:59:59.999 --> 99:59:59.999 there's little build statuses that'll pop up to say, 99:59:59.999 --> 99:59:59.999 "yes, all the tests have passed" or "no, we have some failing test". 99:59:59.999 --> 99:59:59.999 It also affects the status of the Merge button 99:59:59.999 --> 99:59:59.999 providing you a warning saying, 99:59:59.999 --> 99:59:59.999 "wouldn't you like to have all the tests passing 99:59:59.999 --> 99:59:59.999 and this branch be clean, 99:59:59.999 --> 99:59:59.999 before you potentially press this Merge Pull Request button?" 99:59:59.999 --> 99:59:59.999 So now that we have CI status integrated with the idea of human feedback, 99:59:59.999 --> 99:59:59.999 we have holistic, human review plus technical set of tests, 99:59:59.999 --> 99:59:59.999 but not only on the contents of the branch, 99:59:59.999 --> 99:59:59.999 but on a predictive merge of both the branch and its destination, 99:59:59.999 --> 99:59:59.999 so you get to see into the future 99:59:59.999 --> 99:59:59.999 what this would be like if it was merged. 99:59:59.999 --> 99:59:59.999 This doesn't mean that that merge is permanent. 99:59:59.999 --> 99:59:59.999 It'll actually do that predictive merge, see how things go, 99:59:59.999 --> 99:59:59.999 and then let you know if you did merge this in, 99:59:59.999 --> 99:59:59.999 if you would be successful or not. 99:59:59.999 --> 99:59:59.999 So if CI reports a good status, you have social acceptance 99:59:59.999 --> 99:59:59.999 with a couple of thumbs up and ship its in the thread, 99:59:59.999 --> 99:59:59.999 it's time to press the Merge Pull Request button. 99:59:59.999 --> 99:59:59.999 Once that happens, you're also presented with the option to delete the branch, 99:59:59.999 --> 99:59:59.999 which sounds kind of scary, but isn't a bad thing. 99:59:59.999 --> 99:59:59.999 We don't have to really worry about closing out and deleting that branch 99:59:59.999 --> 99:59:59.999 because all of the commits are in the destination branch. 99:59:59.999 --> 99:59:59.999 They've been preserved, 99:59:59.999 --> 99:59:59.999 so you can delete that branch to let people know 99:59:59.999 --> 99:59:59.999 future development isn't happening over there. 99:59:59.999 --> 99:59:59.999 The pull request still stays around, 99:59:59.999 --> 99:59:59.999 in case you want the record of the discussion, 99:59:59.999 --> 99:59:59.999 and your identity and the credit for the work that you've done 99:59:59.999 --> 99:59:59.999 appears in the destination branch along with those merged in commits. 99:59:59.999 --> 99:59:59.999 Thanks for watching this Git and GitHub Foundations episode 99:59:59.999 --> 99:59:59.999 on the World renowned pull request. 99:59:59.999 --> 99:59:59.999 Don't forget to click Subscribe on any of these channels on the side. 99:59:59.999 --> 99:59:59.999 Or, ask us a question or leave a comment down below, 99:59:59.999 --> 99:59:59.999 or check out any of these other educational videos 99:59:59.999 --> 99:59:59.999 on Git and GitHub topics.