-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathpull-request.html
238 lines (166 loc) · 9.88 KB
/
pull-request.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>How do Pull Requests Work?</title>
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
h1, h2, h3 {
font-weight: 400;
margin-bottom: 0;
}
.remark-slide-content h1 { font-size: 3em; }
.remark-slide-content h2 { font-size: 2em; }
.remark-slide-content h3 { font-size: 1.6em; }
.footnote {
position: absolute;
bottom: 3em;
}
li p { line-height: 1.25em; }
.red { color: #fa0000; }
.large { font-size: 2em; }
a, a > code {
color: rgb(249, 38, 114);
text-decoration: none;
}
code {
background: none repeat scroll 0 0 #F8F8FF;
border: 1px solid #DEDEDE;
border-radius: 3px ;
padding: 0 0.2em;
}
.remark-code, .remark-inline-code { font-family: "Bitstream Vera Sans Mono", "Courier", monospace; }
.remark-code-line-highlighted { background-color: #373832; }
.pull-left {
float: left;
width: 47%;
}
.pull-right {
float: right;
width: 47%;
}
.pull-right ~ p {
clear: both;
}
#slideshow .slide .content code {
font-size: 0.8em;
}
#slideshow .slide .content pre code {
font-size: 0.9em;
padding: 15px;
}
.main-title, .title {
background: #272822;
color: #777872;
text-shadow: 0 0 20px #333;
}
.title h1, .title h2, .main-title h1, .main-title h2 {
color: #f3f3f3;
line-height: 0.8em;
}
/* Custom */
.remark-code {
display: block;
padding: 0.5em;
}
</style>
</head>
<body>
<textarea id="source">
<hr>
<img align="left" width="90px" alt="EPN Logo" src="https://upload.wikimedia.org/wikipedia/commons/8/8c/Escudo_de_la_Escuela_Polit%C3%A9cnica_Nacional.png"/>
<img align="right" width="100px" alt="FIS Logo" src="https://fis.epn.edu.ec/images/logo-FIS-sin-fondo.png"/>
<h2 align= "center">
PULL REQUEST
<br>
<img src = "https://www.campusmvp.es/recursos/image.axd?picture=/2017/2T/in-case-of-fire-git-push.png" width = " 350 px" height = " 330 px">
</h2>
</h1>
A pull request – also referred to as a merge request – is an event that takes place in software development when a contributor/developer is ready to begin the process of merging new code changes with the main project repository.
For example, a user named Harry forked a ThanoshanMV repository and made some changes to it. Now Harry can make a ThanoshanMV pull request, but he saw that ThanoshanMV accepted or declined. It's like saying, "ThanoshanMV, could you please pull my changes?"
<h1 align = "center">
<img src="https://backlog.com/app/themes/backlog-child/assets/img/guides/git/collaboration/pull_requests_001.png" width="600" height="200px">
</h1>
---
## How do Pull Requests Work?
A pull request works by allowing developers to create new features or squash bugs without affecting the main project code or what the users are seeing. This way, they are able to write and test code changes locally without having to worry about breaking the overall product.
Pull requests follow a basic five step process:
- Fork Main Repository and Create a Local Clone. First, the developer creates a fork of the main repository, and then clones this onto their local machine.
- Make Needed Changes Locally. The developer then is able to make their needed changes or additions to the code whether they are working on resolving an issue or new feature.
- Push Local Changes to Forked Repository. Once the developer has completed and tested the new code changes, they push these changes back to the forked repository they created in step one.
- Make a Pull Request. This is where the actual pull request takes place! After requesting a pull request, the main repository maintainer is alerted for review. The maintainer will then review the work done in the developer’s forked repository, and then make any comments or request any edits that need to be made for approval.
- Any edits are then sent back to the developer for additional commits (changes to code) that may be needed.
- If no edits are needed, the pull request is approved by the maintainer.
- Merge with Main Project. Once the repository maintainer has approved a pull request, the developer’s new updates in the forked repository are merged with the main project repository. The product is then updated with the new feature or bug fix, and can now be viewed by end users.
In some cases, a developer may also make a pull request for a feature or update that is not yet completed. This way, if a developer is stuck on a new update they’ve been working on, they can now get feedback from other team members and work through possible solutions.
In either case, using pull requests ensures that any new update for a given project has been thoroughly reviewed and approved before it is merged with the main repository. This helps to prevent future issues and ensures a seamless user experience with minimal downtime.
---
## Creating a Pull Request
Creating pull requests may vary from organization to organization based on the tools being used and the type of repository (ex: GitHub, BitBucket, etc.). However, creating a pull request often involves these same three elements:
### Drafting
When creating a pull request, the developer will first begin with a draft. Here, they will be able to title and briefly describe their code changes. They will need to include information about the type of update (whether it’s a new feature or a bug fix) as well as its source repository/branch and destination repository/branch.
A draft pull request cannot be merged until the developer has marked it as ready for review.
### Merging
Merging occurs once a developer’s submitted pull request has been approved by the repository maintainer. Before merging, the repository maintainer will need to review the developer’s completed work. They will comment on any issues, and request edits from the developer as needed. Once any and all updates have been made, the repository maintainer can then safely merge the updates with the main project repository, making it live for end users.
### Updating
If the repository maintainer requires any changes to the code updates before merging, the developer will be alerted and provided with any comments or feedback for fixing the issue. Once the developer has resolved the issue, they can update the pull request with their new commits added for further review and approval.
---
## An Example of a Pull Request
Now that we’ve gone through what a pull request is and how they work, let’s take a look at a possible pull request in action.
Now that we’ve gone through what a pull request is and how they work, let’s take a look at a possible pull request in action.
1. Russell is a developer at a software company that has a mobile application that lets users rate and review different wines.
2. Russell needs to create a new feature that allows the user to highlight their “Five Favorite Wines”
3. To begin working on this new feature, Russell first creates a fork of the main repository and clones this to his local machine.
4. Russell then develops this new feature locally.
5. Once completed, Russell can push his code updates to the forked repository he created.
6. Now Russell can create a pull request!
7. Once the pull request has been submitted, Erica (the Repository Maintainer) is alerted to begin reviewing Russell’s new code update.
8. Erica can then request any follow-up commits from Russell as needed.
9. When any and all change requests are made, Erica will then approve Russell’s pull request.
10. Russell’s new update is then merged with the main project repository, and application users can now begin using the new application feature.
---
## Commands
Here are the most important commands that you'll use when you have to do a pull request. All this commands can be executed on Git Bash.
You'll use the next command for "download" your fork and make it become a local respository on your PC. Make sure that bash is opened in the directory you want to download the project.
```bash
git clone https://github.com/YourUser/YourForksName
```
Once you made all changes needed, you can make a commit to save changes to your local respository. Using the commands below will allow you to do this.
```bash
git add hereTheFileYouChange
git commit -m "Here a short description of the changes made"
```
You can "push" the changes you made on your local repository and upload them to your remote repository (your fork). Also, you can update your local repository by downloading the changes from your fork using "pull" command. Be sure to push the name of the branch you want to use. In this example, it is main branch.
```bash
git push origin main
git pull origin main
```
---
## Video
Understanding how to create a pull request can be difficult, so here's a video that you can checkout to help you to understand how to make a pull request effectively.
I recommend you to take notes 😉📝
<div align="center">
<br>
<iframe width="560" height="315" src="https://www.youtube.com/embed/Zqft6yNRuNs" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
As you can see, creating a pull request is not so difficult and it is really useful when you want to use GitHub to colaborate with others.
---
## Conclusions
- Pull Request is the final step to colaborate with other's projects.
- To make a pull request, you just have to make a fork of the project, clone that repository locally, make your changes, push them to your fork and create a pull request.
- One person will be in charge of approving pull requests, verifying if there are any conflicts, and checking to see if any changes need to be made.
- If you pull request is approved, it will be merged to the main project and you'll be shown as a contributor od the project.
<div align="center">
<br>
<img src="https://i.gifer.com/7IjS.gif" height="300">
</div>
</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
<script>
var slideshow = remark.create();
</script>
<script></script>
</body>
</html>