Photo by Roman Synkevych 🇺🇦 on Unsplash
How to Make a PR(Pull Request) In GITHUB
Step by step demonstration.
Note: Here we are showing a forked repository
A "pull request" is you requesting the target repository to please grab your changes. A "push request" would be the target repository requesting you to push your changes
step 1: Go to the repository in Git Hub that you wanted to fork.
Here in my case, I am taking 90daysofdevops repository. I need to fork that repository to make changes to the repository.
once we start forking the repository, it will ask us to save in our github repository with our custom name.
step 2: cloning to our local repository
Before he starts writing any code/making any changes. He needs to create a new branch for the feature. This branch is what he will use as the source branch of the pull request (PR)
Git checkout -b some-feature
#edit some code
git commit -a -m “Add the first draft of some feature”
He can use as many commits as he needs to create the feature. And if the feature’s history is messier than he would like, he can use an interactive rebase to remove or squash unnecessary commits. For larger projects, Cleaning up a feature’s history makes it much easier for the project maintainer to see what’s going on in the pull request.
step 3: pushing to the GitHub repo
once Charan’s feature is complete, he pushes the feature branch to his own GitHub repository (not the official repository ) with simple
$ git push origin some-branch
This makes her changes available to the project maintainer ( or any collaborators who might need access to them )
step 4: Make PR on GitHub
once it pushes to the remote repository(GitHub), Charan can create a pull Request (PR) through his GitHub account by navigating to his forked repository and clicking the Pull Request button in the top-right corner.
step 5:
The resulting form automatically sets my repository as the source repository, and it asks him to specify the source branch, The destination repository and the destination branch
Charan wants to merge her feature branch into the main codebase, so the source branch is her feature branch, the destination repository is Naga’s public repository, and the destination branch is the main one. Charan also needs to provide a title, and description for the pull request, If there are other people who need to approve the code besides Naga then charan can enter them in the Reviewers field.
After charan creates the pull request, a notification will be sent to Naga via his github feed and (optionally ) via email
Naga can access all of the Pull Requests people have filled by clicking on the pull request tab in his own GitHub repository, Clicking on charan’s pull request will show Naga a description of the pull request, The feature’s commit history. And a diff of all the changes it contains.
If he thinks the feature is ready to merge into the project, all he has to do is hit the Merge button to approve the pull request and merge Charan’s feature into his main branch.
But, let’s say Naga found a small bug in Charan’s code and needs him to fix it before merging it in. Naga can either post a comment to the pull request as a whole or he can select a specific commit in the feature history to comment on.
If charan has any questions about the feedback, Charan can respond inside the pull request, treating it as a discussion forum for her feature.
To correct the error, Charan adds another commit to his feature branch and pushes it to his GitHub repository. Just like he did the first time around. This commit is automatically added to the original pull request, and Naga can review the changes again, right next to his original comment
Naga accepts the changes, merges the feature branch into the main, and closes the pull request. The feature is now integrated into the project. And any other developers working on it can pull it into their own local repositories using the standard git pull command.
That's it for these blog.
Thanks for your time. Hope it added some value to your learning journey.
Please provide your valuable feedback by doing like, share and commenting.
keep learning, Keep growing.....