fetch

Git Github Tutorial 10: What is Pull Request?



Sharing buttons:

hello friends in this tutorial we are

going to see what is pull request and

github on github owner can share his

code with others

now other person can look at the code

and he can make changes to fix a bug or

add an enhancement and then send a

request to the owner to pull or merge

his core changes into honors repository

this request is called a pull request

let us understand this by using this

picture these four people on this github

repo let's say this is the repository

for node.js which is an open source

project this guy here

his name is Tom unless it Tom looks at

node.js code base and then he realizes

that he needs to fix a some bug or make

sanim and enhancement now since this is

an open source project he can copy the

project into his local github private

repository then pull the project on his

local computer make core changes so this

blue color indicates the coaching that

he made and then he can push that into

his own private github repository after

that he can create a pull request or

asking owners to pull his core changes

into owners repository when this request

is sent owners can see the difference

which is this blue color line code

change and they can either comment or

they can just accept the request

directly so pull request allows you to

start a conversation around that code

change between the owners and between

the code contributor so this promotes of

collaboration and pull request is one of

the reasons why github has become very

popular ok now let's look at the

demonstration so let's say we have

these two users Brad and Angelina are

who not only collaborate as a wife and

husband or actors but they want to do a

collaboration when it comes to

programming as well so this guy has this

code repository called hungry and he has

all this code now if you look at the URL

that is Brad 27th oh so this is owned by

Brad ok now

Angelina looks at this codebase and she

wants to let's say make some changes

here so she will then go and so the

person right here is Angelina so she

will open odd this repository here so as

you can see here the signed-in user is

Angelina but she has opened the

repository from Brad and she can click

on this fork button to copy Brad's code

into her own private repo ok so now she

has Corbis copied and now you can see

that is the links is Angelina ok

so typically she will pull the if the

code changes are huge civil pull this

code base into her local computer and

make code changes run the code and do

some test verified and once things look

ok she will push it here to her own

private repository but since this is a

tutorial I am going to make code change

directly on this web website so if you

don't know our github allows you to edit

code directly on the website so I will

just click on edit file and make a code

change here and I will

and hungry equal to Y so she wants to

add Y as a valid input okay so let me

make this bigger so that you can see

what Co change I made so she just added

this line okay and then she can commit

her changes you can say okay added Y as

a valid answer and commit changes so

once you do that and if you go to your

commits you can see the difference here

by clicking here so it says you added

this thing here okay now it is the time

to create a pull request so Angelina is

ready with her chord changes now she

wants to merge these chord changes here

in to Brad's repository so for that she

will click on pull request here okay and

then let's see so here there is a button

new pull request so click on new pull

request so here it will tell you from

where you are merging to which

repository so your base the repository

is Brad 27 so this says that from

Angelina hungry a code repository master

branch I want to merge into brass

repository okay and it allows you to see

the difference so if I am Angelina

Angelina can see that I am asking to add

this coaching okay so I'll click on

create pull request here you can add

some meaningful comment here and then

just say create pull request so at this

point the Corps from here it's not

merged here okay so now Angelina is kind

of waiting for Brad to review his whole

code okay so if I am Brad I will are in

this area

if I just refresh my webpage I will see

this little notification okay

and this notification is telling me that

let me maximize the screen so this

notification is not telling me that uh

someone has sent me a pull request so I

will click here and if I want to see the

actual cogeco changes I can go here in

file chain and I can see the code

changes now I'm Brad let's say and I

like this call change but then one thing

is I want to add capital y as an input

so I will put a comment saying that a

good change I like it can you also add

capital y ah so then you will put your

comment here and once you put your

command now let's go back to Angelina

because the ball is in Angelina's code

now okay and once she opens this pull

request see will see a comment from Brad

twenty-seven saying that good change I

like it can you also add y ok so now

what Angelina will do is she kind of

agrees with bad so she will go ahead and

add Y as well so let's see so here I'm

in this pull request ok

just a second okay sorry so I'm looking

at Brad scores

okay I shouldn't be so this is bad

suppository okay let me go back so

Angelina should be looking at her

repository which is hungry okay so here

what she will do is she will add capital

y as a valid input so we'll say okay and

hungry equal to capital y then that also

is a valid input added capital y into

list of valid answers okay she will

commit her core change and let's look at

the full request okay so the pull

request will be here

okay so now you can see here that there

is added wine to list of valid answers

and if you look at this files change now

I have both of this available in my pull

request okay so if I am bread

I will also again get a notification

saying that Angelina Argosy there is a

notification here saying that there is

some update on this pull request so you

can view the Jean that was made last

time or view you can view all the

changes so now this change kind of looks

okay to me and I'm fine merging it into

my depository so what I will do is I

will go here and I will click on merge

button okay eventually you will click on

merge button to merge it so now what

happened is in brass repository I have

now d score changes so this completes

the cycle and now I have Brad and

Angelina both showing up as a decor

contributor okay so that was just a nice

quick demo of pull request they are

extremely popular in open source world

where there is a open source project and

multiple people contribute to it okay

and this whole model of pull request and

sharing code is number one reason why

github is so popular