You can watch the youtube video explaining this topic here.
A pull request is a way for you to contribute to a project by making changes to the code of a project, and then asking the repository owner to merge your changes with the current main project.
We've done a blogpost on pull requests for github, so in this post we'll look at pull requests bitbucket. There's a different etiquette for bitbucket pull requests compared to github, so we'll need to use a different way of making the pull requests. The two ways that we can raise a pull request on bitbucket are (1) by forking the repository, or (2) by making a new branch.
The Fork Way
On the bitbucket website, you can fork a repository (making a copy of your own), make your changes to your personal version of the repository, and then go back to the original repository and raise the pull request, offering your version of the code to the original repository.
This is very good for open source projects, which github is famous for, but isn't as good for bitbucket. Nevertheless, the process is:
This method works, but has a lot of drawbacks. The next way to make a Pull Request is the preferred method.
The Branch Way (Preferred)
If your project is on bitbucket, then you're likely working on a small-ish team with other people. This means that you have more freedom to edit the actual project, and so forking is unnecessary. (Your boss probably doesn't want random forks of the project all over the place. And even if your code doesn't get merged immediately, it should be part of the main project for other people to see.) For this reason, creating a branch on the project repository and making the pull request from that branch is best practice.
The process for making a pull request via making a new branch is:
1. Clone the bitbucket repository you want to contribute too.
2. (Make sure you're on the right branch and in the project directory, on your local computer.)
3. Make the changes to the project, on your local computer.
4. Add and commit the changes on your computer. (Make as many commits as you want.)
5. Create a new branch for your changes, on your computer.
Note: Make your branch name descriptive. For example, naming it "feature/XYZ" if it's a new feature and is about XYZ is easy to let anyone know what the branch is for.
7. Push your changes to the bitbucket repository.
8. In the repository in bitbucket, go to the 'Pull requests' tab, and click "Create pull request".
And your PR is created. Using branches is pretty simple, and much cleaner than forking. All professional teams should be handling their pull requests this way.
Pull Requests on bitbucket are pretty easy. Make sure you use the branching technique when possible, though, as it becomes very relevant when wanting to edit your Pull Request.
In the next blogpost, we'll look at how to make changes to the code in your Pull Request after making it.
Hi, I'm srcmake. I play video games and develop software.
Pro-tip: Click the "DIRECTORY" button in the menu to find a list of blog posts.
License: All code and instructions are provided under the MIT License.