Pull Request
A pull request (often shortened to PR) is a mechanism for submitting changes to the source code of a software project. It allows developers to submit changes to the repository of another project, intending to review and possibly integrate those changes into the original project's codebase.
Pull requests let you tell others about changes you've pushed to a branch in a repository on Gitopia. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.
Pull Requests has its own section in every repository on Gitopia.
Creating a Pull Request
Step 1: Navigate to Repository
Navigate to the main page of your repository.
Step 2: Click on "New Pull Request"
Next, navigate to the Pull Requests section of the repository and click on New Pull Request to create a pull request.
Step 3: Select Source and Target Branch
Now, select the source branch(the branch you made changes in) and the target branch(the branch you'd like to merge your changes into) from their respective drop-down menus.
Once you have selected the source and target branches, you can compare your changes from the diff display.
You have two options for viewing a diff:
- The unified view shows updated and existing content together in a linear view.
- The split view shows old content on one side and new content on the other side.
Step 4: Create the Pull Request
Click on Create Pull Request.
Type a title and description for your pull request. Optionally, you can assign Reviewers or apply a Label.
- When you are finished, to create a pull request that is ready for review, click Create Pull Request.
Step 5: Review and Merge
After your pull request has been reviewed, it can be merged into the repository.
Creating a Pull Request from a fork
Step 1: Navigate to Repository
Navigate to the repository where you created your fork.
Step 2: Click on "New Pull Request"
Next, navigate to the Pull Requests section of the repository and click on New Pull Request to create a pull request.
Step 3: Select Source and Target Branch
Now, select the source branch(the branch that you made changes in) and the target branch(the branch of the upstream repository you'd like to merge changes into) from their respective drop-down menus.
Step 4: Create the Pull Request
Click on Create Pull Request.
Type a title and description for your pull request. Optionally, you can assign Reviewers or apply a Label.
- When you are finished, to create a pull request that is ready for review, click Create Pull Request.
Step 5: Review and Merge
After your pull request has been reviewed, it can be merged into the repository.
Merging a Pull Request
Step 1: Navigate to Repository Pull Requests
Navigate to the main page of your repository and click on Pull Requests.
Step 2: Select the Pull Request
In the "Pull Requests" list, click the pull request you'd like to merge.
Step 3: Merge the Pull Request
- Click on Merge Pull Request.
- You will first be prompted to give forking access to the Gitopia data server. Click on Grant Access.
This prompt will show up only once for every user. This authorization is required to keep the state of gitopia blockchain and git server consistent. Only after successful fork or merge, git server broadcasts the relevant transaction on behalf of the user. This authorization is restricted to fork and merge PR transactions.
- Your Pull Request has been merged.
Step 4: Verify the Merge
Navigate to the Code section of the repository to see the results.