Home » Git Tutorial » Create and Merge Pull Request

Create and Merge Pull Request


Reading Time - 5 mins

If you want to send a pull request from your development branch say “A” to the main branch, the “master” branch.

Make sure, the branch is already published to the remote repository.
When a branch is published, you will get a notification on the web about the changes that has been published to the development branch.

Click on “Compare & pull request” to raise a pull request.

If the branch has been published long back, you can select the development branch say “A” , from the branch tab and click on “New pull request” button.

The above click will open a “compare” screen which will signify the relative code changes that has been concluded from the master branch.

Like we just added, an H1 or Heading for the index.html, which appears in green.

You can add a suitable heading to the pull request, or else it pick up the last commit message from the branch.
In  the Leave a comment section, we can write a long description or text, to signify why and what was changed.
In organization, we can put in the links of the review, attach certain links of the evidence, or put a detail description, on what was the requirement for the required change.

Creating a pull request from GitHub Desktop

Though there is an option to raise a pull request from GitHub Desktop, it in turns open a web interface which is displayed on the top.

When you click on the “Create pull request”, you need to choose a base branch say “A” and the main branch master”.

READ  Installing Git on Windows

Creating a pull request from SourceTree

To raise pull request from source tree, the procedure is somewhat same as the GitHub Desktop.

Click on create pull request

Put in the base branch and the master branch as stated above.

Click on “Create pull request on WEB”

This will in turn send a post request to web to create a pull request, if there are no conflicts, the pull request will be created.


Merging Pull request

Once the pull request is created, number of pull request available to merge will be shown in the “Pull request” tab.

Click on the available “pull request”

Click on “Merge pull request”.
This will merge the changes in the branch “A” to the master.

Generally speaking, the Merge has to be done by the verifier who has assigned you the issue to work on this feature.

After a successful merge, you may delete the branch.

Conclusion
In this tutorial, we understood, how to compare and open a pull request to master, and how to merge your pull request to the master branch, in order for the latest change from the development branch to be available in master branch.

Array Interview Questions
Graph Interview Questions
LinkedList Interview Questions
String Interview Questions
Tree Interview Questions