0:00:00.067,0:00:01.784
Pull requests are a core part
0:00:01.784,0:00:04.152
of making a change[br]to any GitHub repository.
0:00:04.402,0:00:06.207
Let's figure out[br]how to use them effectively.
0:00:06.975,0:00:08.689
♪ (music) ♪
0:00:11.512,0:00:12.829
Pull requests are a means
0:00:12.829,0:00:15.550
of submitting a change[br]to another code base.
0:00:15.742,0:00:17.814
You can do this[br]whether you're a core contributor,
0:00:17.814,0:00:19.764
or you're working[br]at arm's length with a fork.
0:00:20.014,0:00:22.431
If you're not a core contributor,[br]you can fork this project,
0:00:22.431,0:00:24.212
work on that change on your own
0:00:24.212,0:00:26.088
and send that change back as a proposal
0:00:26.088,0:00:27.967
on a pull request[br]to the original author.
0:00:28.328,0:00:32.843
It means that making a correction[br]becomes easier than making a complaint,
0:00:32.843,0:00:37.022
which is why GitHub has really facilitated[br]the growth and development of Open Source.
0:00:37.428,0:00:39.732
Just make that edit,[br]make it better,
0:00:39.732,0:00:41.280
everyone benefits.
0:00:41.280,0:00:46.515
This also applies to closed projects,[br]corporate projects, private repos.
0:00:49.587,0:00:51.725
If you do have access[br]to push to a repository,
0:00:51.725,0:00:54.270
you should still work on a branch[br]and send that pull request
0:00:54.270,0:00:55.962
to get some review on your code.
0:00:55.962,0:00:57.709
This means you're going[br]to create a branch,
0:00:57.709,0:01:00.595
start making some commits,[br]and when you're ready to get it reviewed,
0:01:00.595,0:01:03.861
send that back to everyone else[br]on your team in that pull request.
0:01:04.424,0:01:06.931
This means that a pull request[br]is a conversation,
0:01:06.931,0:01:09.973
not just a one-shot submission[br]of what's on a branch,
0:01:09.973,0:01:12.650
but rather, a little bit[br]of dialogue and discussion,
0:01:12.650,0:01:16.565
some revision to the code,[br]that all appears in chronological order,
0:01:16.565,0:01:19.860
and finally, an approval,[br]or in the terrible case,
0:01:19.860,0:01:24.701
a thumbs down that says, "this does not[br]seem like a wise change to the code base."
0:01:24.701,0:01:29.106
But in either of those two situations,[br]the URL and the pull request lives on.
0:01:31.761,0:01:33.150
You don't have to stop talking
0:01:33.150,0:01:35.253
just because things[br]were closed out and not accepted.
0:01:35.392,0:01:37.514
You can continue to find out[br]why it wasn't accepted
0:01:37.514,0:01:39.234
and what changes[br]you can make in the future
0:01:39.234,0:01:41.441
to ensure all your pull requests[br]will be accepted.
0:01:41.613,0:01:43.753
This also serves as an educational tool
0:01:43.794,0:01:45.912
for people who join the team[br]at a later time.
0:01:46.052,0:01:48.824
These pull requests are dialogues[br]of what type of change
0:01:48.824,0:01:51.150
might be culturally acceptable here,
0:01:51.150,0:01:53.517
what are the expectations,[br]requirements, formats
0:01:53.517,0:01:55.254
that people expect stuff in,
0:01:55.254,0:01:58.553
and you can save these URLs[br]and point to them as educational tools
0:01:58.553,0:02:00.134
for these new individuals.
0:02:00.797,0:02:03.427
This means you don't have[br]to forward on some email conversation
0:02:03.427,0:02:05.305
about how a feature came to be.
0:02:05.409,0:02:08.350
You can just point someone to a URL[br]and they can look at it for all time.
0:02:11.517,0:02:13.715
We're also interested[br]in the technical inputs,
0:02:13.715,0:02:14.906
not just the human ones.
0:02:14.906,0:02:16.884
A CI system, continuous integration,
0:02:16.884,0:02:21.179
like Travis, Hudson,[br]Jenkins, Circle CI, Team City,
0:02:21.179,0:02:23.645
can all integrate[br]with a GitHub pull request
0:02:23.645,0:02:26.323
and report the build status[br]for this branch,
0:02:26.323,0:02:28.563
the fundamental unit of a pull request,
0:02:28.563,0:02:30.824
right in the line with that conversation.
0:02:31.208,0:02:34.184
So that means along with the conversation[br]and the changes to code,
0:02:34.184,0:02:36.764
there's little build statuses[br]that'll pop up to say,
0:02:36.764,0:02:39.997
"yes, all the tests have passed"[br]or "no, we have some failing test".
0:02:40.582,0:02:43.036
It also affects the status[br]of the Merge button
0:02:43.036,0:02:44.754
providing you a warning saying,
0:02:44.754,0:02:47.015
"wouldn't you like to have[br]all the tests passing
0:02:47.015,0:02:48.658
and this branch be clean,
0:02:48.658,0:02:51.859
before you potentially press[br]this Merge Pull Request button?"
0:02:52.049,0:02:56.870
So now that we have CI status integrated[br]with the idea of human feedback,
0:02:56.870,0:03:01.852
we have holistic, human review[br]plus technical set of tests,
0:03:01.852,0:03:04.136
but not only on the contents[br]of the branch,
0:03:04.136,0:03:09.215
but on a predictive merge[br]of both the branch and its destination,
0:03:09.556,0:03:11.331
so you get to see into the future
0:03:11.331,0:03:13.034
what this would be like if it was merged.
0:03:13.034,0:03:14.930
This doesn't mean[br]that that merge is permanent.
0:03:14.930,0:03:17.511
It'll actually do that predictive merge,[br]see how things go,
0:03:17.511,0:03:19.644
and then let you know[br]if you did merge this in,
0:03:19.644,0:03:21.280
if you would be successful or not.
0:03:23.836,0:03:27.879
So if CI reports a good status,[br]you have social acceptance
0:03:27.879,0:03:30.462
with a couple of thumbs up[br]and ship its in the thread,
0:03:30.462,0:03:32.729
it's time to press[br]the Merge Pull Request button.
0:03:33.104,0:03:36.560
Once that happens, you're also presented[br]with the option to delete the branch,
0:03:36.560,0:03:39.473
which sounds kind of scary,[br]but isn't a bad thing.
0:03:39.515,0:03:42.481
We don't have to really worry[br]about closing out and deleting that branch
0:03:42.481,0:03:44.804
because all of the commits[br]are in the destination branch.
0:03:44.804,0:03:45.926
They've been preserved,
0:03:45.926,0:03:47.857
so you can delete that branch[br]to let people know
0:03:47.857,0:03:49.778
future development[br]isn't happening over there.
0:03:50.096,0:03:52.025
The pull request still stays around,
0:03:52.025,0:03:53.945
in case you want[br]the record of the discussion,
0:03:53.945,0:03:57.038
and your identity and the credit[br]for the work that you've done
0:03:57.038,0:04:00.814
appears in the destination branch[br]along with those merged in commits.
0:04:02.532,0:04:05.210
Thanks for watching this Git[br]and GitHub Foundations episode
0:04:05.210,0:04:07.695
on the World renowned pull request.
0:04:07.695,0:04:10.582
Don't forget to click Subscribe[br]on any of these channels on the side.
0:04:11.173,0:04:14.657
Or, ask us a question[br]or leave a comment down below,
0:04:14.950,0:04:17.376
or check out any[br]of these other educational videos
0:04:17.376,0:04:19.277
on Git and GitHub topics.
0:04:19.546,0:04:21.840
♪ (outro music) ♪