1 99:59:59,999 --> 99:59:59,999 Pull requests are a core part 2 99:59:59,999 --> 99:59:59,999 of making a change to any GitHub repository. 3 99:59:59,999 --> 99:59:59,999 Let's figure out how to use them effectively. 4 99:59:59,999 --> 99:59:59,999 (smooth music) 5 99:59:59,999 --> 99:59:59,999 Pull requests are a means 6 99:59:59,999 --> 99:59:59,999 of submitting a change to another code base. 7 99:59:59,999 --> 99:59:59,999 You can do this whether you're a core contributor, 8 99:59:59,999 --> 99:59:59,999 or you're working at arm's length with a fork. 9 99:59:59,999 --> 99:59:59,999 If you're not a core contributor, you can fork this project, 10 99:59:59,999 --> 99:59:59,999 work on that change on your own 11 99:59:59,999 --> 99:59:59,999 and send that change back as a proposal 12 99:59:59,999 --> 99:59:59,999 on a pull request to the original author. 13 99:59:59,999 --> 99:59:59,999 It means that making a correction becomes easier than making a complaint, 14 99:59:59,999 --> 99:59:59,999 which is why GitHub has really facilitated the growth and development of Open Source. 15 99:59:59,999 --> 99:59:59,999 Just make that edit, make it better, 16 99:59:59,999 --> 99:59:59,999 everyone benefits. 17 99:59:59,999 --> 99:59:59,999 This also applies to closed projects, corporate projects, private repos. 18 99:59:59,999 --> 99:59:59,999 If you do have access to push to a repository, 19 99:59:59,999 --> 99:59:59,999 you should still work on a branch and send that pull request 20 99:59:59,999 --> 99:59:59,999 to get some review on your code. 21 99:59:59,999 --> 99:59:59,999 This means you're going to create a branch, 22 99:59:59,999 --> 99:59:59,999 start making some commits, and when you're ready to get it reviewed, 23 99:59:59,999 --> 99:59:59,999 send that back to everyone else on your team in that pull request. 24 99:59:59,999 --> 99:59:59,999 This means that a pull request is a conversation, 25 99:59:59,999 --> 99:59:59,999 not just a one-shot submission of what's on a branch, 26 99:59:59,999 --> 99:59:59,999 but rather, a little bit of dialogue and discussion, 27 99:59:59,999 --> 99:59:59,999 some revision to the code, that all appears in chronological order, 28 99:59:59,999 --> 99:59:59,999 and finally, an approval, or in the terrible case, 29 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." 30 99:59:59,999 --> 99:59:59,999 But in either of those two situations, the URL and the pull request lives on. 31 99:59:59,999 --> 99:59:59,999 You don't have to stop talking 32 99:59:59,999 --> 99:59:59,999 just because things were closed out and not accepted. 33 99:59:59,999 --> 99:59:59,999 You can continue to find out why it wasn't accepted 34 99:59:59,999 --> 99:59:59,999 and what changes you can make in the future 35 99:59:59,999 --> 99:59:59,999 to make sure all your pull requests will be accepted. 36 99:59:59,999 --> 99:59:59,999 This also serves as an educational tool 37 99:59:59,999 --> 99:59:59,999 for people who join the team at a later time. 38 99:59:59,999 --> 99:59:59,999 These pull requests are dialogues of what type of change 39 99:59:59,999 --> 99:59:59,999 might be culturally acceptable here, 40 99:59:59,999 --> 99:59:59,999 what are the expectations, requirements, formats 41 99:59:59,999 --> 99:59:59,999 that people expect stuff in, 42 99:59:59,999 --> 99:59:59,999 and you can save these URLs and point to them as educational tools 43 99:59:59,999 --> 99:59:59,999 for these new individuals. 44 99:59:59,999 --> 99:59:59,999 This means you don't have to forward on some email conversation 45 99:59:59,999 --> 99:59:59,999 about how a feature came to be. 46 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. 47 99:59:59,999 --> 99:59:59,999 We're also interested in the technical inputs, 48 99:59:59,999 --> 99:59:59,999 not just the human ones. 49 99:59:59,999 --> 99:59:59,999 A CI system, continuous integration, 50 99:59:59,999 --> 99:59:59,999 like Travis, Hudson, Jenkins, Circle CI, Team City, 51 99:59:59,999 --> 99:59:59,999 can all integrate with a GitHub pull request 52 99:59:59,999 --> 99:59:59,999 and report the build status for this branch, 53 99:59:59,999 --> 99:59:59,999 the fundamental unit of a pull request, 54 99:59:59,999 --> 99:59:59,999 right in the line with that conversation. 55 99:59:59,999 --> 99:59:59,999 So that means along with the conversation and the changes to code, 56 99:59:59,999 --> 99:59:59,999 there's little build statuses that'll pop up to say, 57 99:59:59,999 --> 99:59:59,999 "yes, all the tests have passed" or "no, we have some failing test". 58 99:59:59,999 --> 99:59:59,999 It also affects the status of the Merge button 59 99:59:59,999 --> 99:59:59,999 providing you a warning saying, 60 99:59:59,999 --> 99:59:59,999 "wouldn't you like to have all the tests passing 61 99:59:59,999 --> 99:59:59,999 and this branch be clean, 62 99:59:59,999 --> 99:59:59,999 before you potentially press this Merge Pull Request button?" 63 99:59:59,999 --> 99:59:59,999 So now that we have CI status integrated with the idea of human feedback, 64 99:59:59,999 --> 99:59:59,999 we have holistic, human review plus technical set of tests, 65 99:59:59,999 --> 99:59:59,999 but not only on the contents of the branch, 66 99:59:59,999 --> 99:59:59,999 but on a predictive merge of both the branch and its destination, 67 99:59:59,999 --> 99:59:59,999 so you get to see into the future 68 99:59:59,999 --> 99:59:59,999 what this would be like if it was merged. 69 99:59:59,999 --> 99:59:59,999 This doesn't mean that that merge is permanent. 70 99:59:59,999 --> 99:59:59,999 It'll actually do that predictive merge, see how things go, 71 99:59:59,999 --> 99:59:59,999 and then let you know if you did merge this in, 72 99:59:59,999 --> 99:59:59,999 if you would be successful or not. 73 99:59:59,999 --> 99:59:59,999 So if CI reports a good status, you have social acceptance 74 99:59:59,999 --> 99:59:59,999 with a couple of thumbs up and ship its in the thread, 75 99:59:59,999 --> 99:59:59,999 it's time to press the Merge Pull Request button. 76 99:59:59,999 --> 99:59:59,999 Once that happens, you're also presented with the option to delete the branch, 77 99:59:59,999 --> 99:59:59,999 which sounds kind of scary, but isn't a bad thing. 78 99:59:59,999 --> 99:59:59,999 We don't have to really worry about closing out and deleting that branch 79 99:59:59,999 --> 99:59:59,999 because all of the commits are in the destination branch. 80 99:59:59,999 --> 99:59:59,999 They've been preserved, 81 99:59:59,999 --> 99:59:59,999 so you can delete that branch to let people know 82 99:59:59,999 --> 99:59:59,999 future development isn't happening over there. 83 99:59:59,999 --> 99:59:59,999 The pull request still stays around, 84 99:59:59,999 --> 99:59:59,999 in case you want the record of the discussion, 85 99:59:59,999 --> 99:59:59,999 and your identity and the credit for the work that you've done 86 99:59:59,999 --> 99:59:59,999 appears in the destination branch along with those merged in commits. 87 99:59:59,999 --> 99:59:59,999 Thanks for watching this Git and GitHub Foundations episode 88 99:59:59,999 --> 99:59:59,999 on the World renowned pull request. 89 99:59:59,999 --> 99:59:59,999 Don't forget to click Subscribe on any of these channels on the side. 90 99:59:59,999 --> 99:59:59,999 Or, ask us a question or leave a comment down below, 91 99:59:59,999 --> 99:59:59,999 or check out any of these other educational videos 92 99:59:59,999 --> 99:59:59,999 on Git and GitHub topics.