-
Notifications
You must be signed in to change notification settings - Fork 58
Pull Requests !
Welcome to the Hacktoberfest-Projects wiki!
Pull requests are a feature that makes it easier for developers to collaborate using Github. They provide a user-friendly web interface for discussing proposed changes before integrating them into the official project.
In their simplest form, pull requests are a mechanism for a developer to notify team members that they have completed a feature. Once their feature branch is ready, the developer files a pull request. This lets everybody involved know that they need to review the code and merge it into the main branch.
But, the pull request is more than just a notification—it’s a dedicated forum for discussing the proposed feature. If there are any problems with the changes, teammates can post feedback in the pull request and even tweak the feature by pushing follow-up commits. All of this activity is tracked directly inside of the pull request.
When it comes to discussing changes, developers typically have to rely on email threads. This can become haphazard, especially when follow-up commits are involved. Pull requests put all of this functionality into a friendly web interface right next to your Github repositories.
Let's understand this with the motive to fork the Tenet-Coding/ArtofCoding Repository. Consider that you want to contribute to us or propose any desirable changes.
Firstly Fork the Repository and create a copy for you. This will allow you to separate your copy from the original source code of any repository. Now you got 2 options to go ahead with.
- Pull Request directly on main branch of your forked copy.
- Pull Request on a pre-existing branch on repository or newly created branch by you.
If you choose to create a new branch. Firstly, Make sure that you have all the updates included in your forked repository same as the original one. To make sure just follow with the command :
git pull origin master
This will make everything updated on your fork. Now it time to create a new branch and get started with it. So, To create a new branch go to your terminal and write
git checkout -b <new-branch-name> [<base-branch-name>]
Here, <base-branch-name>
is option to provide. In case you just do git checkout <new-branch-name>
it will automatically select the master branch to be the base branch by default.
Let's say we want to create a branch named breakfree
git checkout -b breakfree
git push origin breakfree
Now commit the changes as you wanted to do to your newly created branch and then we will look how to pull request from that branch of yours.
From the top right corner of your github, On Clicking the New Pull Request button, It will allow you to choose the branch on which you want to merge your changes from your branch. For example,
You can select any branch of your choice and in a similar manner you can select even the base branch. By default it will be main branch itself.
Now just give a title to your PR and follow the template made by Tenet-Coding and follow the contribution guidelines.
So, Now the maintainers and collaborators can review your code and if they find everything good then they can Merge your request to the main branch of the repository.
If you feel, now you do not want to merge with the main branch or something is not correct then you can close your PR. You can simply click on the "Close" button on the pull request to close it. Optionally, you can delete the branch directly using the "Delete this branch" button.