Pull Requests are used to propose changes to the project files, and a great way to start a discussion about commits.
Pull requests are used to propose changes to the project files. 0:00 They're a way to start a discussion about commits and 0:04 are often used for code review. 0:06 If you're working solo, you can just use the git commands we learned 0:08 in the first video to push up changes to the master branch. 0:11 But by learning how to use pull requests you'll get to practice the workflow used 0:14 by companies and open source projects. 0:18 GitHub knows that you have added changes to your branch, and 0:21 helpfully recommends that you start a pull request. 0:24 Go ahead and click the compare and pull request button. 0:27 Notice, we can use the drop down here to compare any two branches, but 0:30 we'll leave the default selected. 0:33 GitHub pre-populates the commit message as the pull request title. 0:35 And in the body here, we'll create a message and reference the original issue 0:40 with the number notation, since we just created the ad read me as the first issue, 0:45 we'll type fixes number one and it'll auto populate. 0:50 Next you can leave a comment to describe the changes you made and why. 0:59 When you're finished, click the green button to create a pull request. 1:02 A pull request is typically used as a discussion about the changes being made to 1:14 the repository. 1:18 The view we are in now is called the conversation view, because here we can use 1:19 an at mention to bring someone into the thread and talk about the changes. 1:23 The commits view contains information about who's made changes to the files. 1:29 Each commit is an updated view of the repository, 1:33 allowing us to see how changes have happened from commit to commit. 1:36 The file's change view allows you to see the change that is being proposed. 1:40 We call this the dif. 1:44 The green text is what has been added, and 1:45 if we had deleted anything it would be red. 1:47 If you notice something that needs to be changed in the code, 1:50 you can click on the line number in this view to create a line comment. 1:52 Line level comments are a great way to give additional context on changes and 1:57 are often used in code review. 2:01 If we go back to the pull request view. 2:13 We'll see that the line comment is here. 2:17 If your comment is more general in nature, 2:21 you can also add a comment to the pull request here. 2:24 Most project teams require someone to sign off on the change before this merged, but 2:27 since we aren't collaborating with anyone here, 2:31 if I click the green Merge pull request button and 2:33 confirm, then this will merge our branch add-readme into the master branch. 2:35 Let's review what we learned in this video. 2:42 To open a pull request, you must first have a branch with changes on it 2:44 that you can propose to be added to another branch. 2:47 We clicked the green button to open the pull request and 2:50 added some context, the title and discussion. 2:53 We also viewed the different tabs, the conversation tab, commit tab and 2:56 the files changed tab. 3:00 We learned that if we click merge pull request, 3:01 it will add our changes back into the master branch. 3:04 We could stop there, however, often times after you open a pull request 3:07 you'll either get feedback or think of additional changes you want to make. 3:10 In the last video in the stage we'll go over how to add additional changes and 3:14 how to deal with the merge conflict when your remote repository 3:18 gets out of sync with your local repo. 3:21
You need to sign up for Treehouse in order to download course files.Sign up