1 00:00:00,360 --> 00:00:04,440 Pull requests are used to propose changes to the project files. 2 00:00:04,440 --> 00:00:06,680 They're a way to start a discussion about commits and 3 00:00:06,680 --> 00:00:08,670 are often used for code review. 4 00:00:08,670 --> 00:00:11,590 If you're working solo, you can just use the git commands we learned 5 00:00:11,590 --> 00:00:14,940 in the first video to push up changes to the master branch. 6 00:00:14,940 --> 00:00:18,560 But by learning how to use pull requests you'll get to practice the workflow used 7 00:00:18,560 --> 00:00:20,480 by companies and open source projects. 8 00:00:21,810 --> 00:00:24,500 GitHub knows that you have added changes to your branch, and 9 00:00:24,500 --> 00:00:27,380 helpfully recommends that you start a pull request. 10 00:00:27,380 --> 00:00:30,100 Go ahead and click the compare and pull request button. 11 00:00:30,100 --> 00:00:33,720 Notice, we can use the drop down here to compare any two branches, but 12 00:00:33,720 --> 00:00:35,240 we'll leave the default selected. 13 00:00:35,240 --> 00:00:39,110 GitHub pre-populates the commit message as the pull request title. 14 00:00:40,590 --> 00:00:45,800 And in the body here, we'll create a message and reference the original issue 15 00:00:45,800 --> 00:00:50,750 with the number notation, since we just created the ad read me as the first issue, 16 00:00:50,750 --> 00:00:58,240 we'll type fixes number one and it'll auto populate. 17 00:00:59,360 --> 00:01:02,820 Next you can leave a comment to describe the changes you made and why. 18 00:01:02,820 --> 00:01:06,092 When you're finished, click the green button to create a pull request. 19 00:01:14,204 --> 00:01:18,300 A pull request is typically used as a discussion about the changes being made to 20 00:01:18,300 --> 00:01:19,990 the repository. 21 00:01:19,990 --> 00:01:23,630 The view we are in now is called the conversation view, because here we can use 22 00:01:23,630 --> 00:01:27,280 an at mention to bring someone into the thread and talk about the changes. 23 00:01:29,370 --> 00:01:33,530 The commits view contains information about who's made changes to the files. 24 00:01:33,530 --> 00:01:36,320 Each commit is an updated view of the repository, 25 00:01:36,320 --> 00:01:40,240 allowing us to see how changes have happened from commit to commit. 26 00:01:40,240 --> 00:01:44,240 The file's change view allows you to see the change that is being proposed. 27 00:01:44,240 --> 00:01:45,800 We call this the dif. 28 00:01:45,800 --> 00:01:47,810 The green text is what has been added, and 29 00:01:47,810 --> 00:01:50,300 if we had deleted anything it would be red. 30 00:01:50,300 --> 00:01:52,980 If you notice something that needs to be changed in the code, 31 00:01:52,980 --> 00:01:57,630 you can click on the line number in this view to create a line comment. 32 00:01:57,630 --> 00:02:01,520 Line level comments are a great way to give additional context on changes and 33 00:02:01,520 --> 00:02:03,111 are often used in code review. 34 00:02:13,884 --> 00:02:15,650 If we go back to the pull request view. 35 00:02:17,880 --> 00:02:21,920 We'll see that the line comment is here. 36 00:02:21,920 --> 00:02:24,030 If your comment is more general in nature, 37 00:02:24,030 --> 00:02:26,490 you can also add a comment to the pull request here. 38 00:02:27,550 --> 00:02:31,530 Most project teams require someone to sign off on the change before this merged, but 39 00:02:31,530 --> 00:02:33,540 since we aren't collaborating with anyone here, 40 00:02:33,540 --> 00:02:35,840 if I click the green Merge pull request button and 41 00:02:35,840 --> 00:02:40,430 confirm, then this will merge our branch add-readme into the master branch. 42 00:02:42,300 --> 00:02:44,530 Let's review what we learned in this video. 43 00:02:44,530 --> 00:02:47,790 To open a pull request, you must first have a branch with changes on it 44 00:02:47,790 --> 00:02:50,610 that you can propose to be added to another branch. 45 00:02:50,610 --> 00:02:53,460 We clicked the green button to open the pull request and 46 00:02:53,460 --> 00:02:56,250 added some context, the title and discussion. 47 00:02:56,250 --> 00:03:00,270 We also viewed the different tabs, the conversation tab, commit tab and 48 00:03:00,270 --> 00:03:01,870 the files changed tab. 49 00:03:01,870 --> 00:03:04,130 We learned that if we click merge pull request, 50 00:03:04,130 --> 00:03:07,210 it will add our changes back into the master branch. 51 00:03:07,210 --> 00:03:10,870 We could stop there, however, often times after you open a pull request 52 00:03:10,870 --> 00:03:14,630 you'll either get feedback or think of additional changes you want to make. 53 00:03:14,630 --> 00:03:18,190 In the last video in the stage we'll go over how to add additional changes and 54 00:03:18,190 --> 00:03:21,530 how to deal with the merge conflict when your remote repository 55 00:03:21,530 --> 00:03:23,070 gets out of sync with your local repo.