Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between a Pull Request and a branch?

In the context of GitHub and Atlassian Stash, there is a common feature to do a Pull Request. What's the difference between a Pull Request and a branch? a Pull Request looks like a different way to call a branch or?

like image 647
SkyWalker Avatar asked Sep 27 '13 20:09

SkyWalker


People also ask

Do I need a branch for a pull request?

If you're working in the shared repository model, we recommend that you use a topic branch for your pull request. While you can send pull requests from any branch or commit, with a topic branch you can push follow-up commits if you need to update your proposed changes.

Why do we use branches and pull requests?

Branches and pull requests are essential to the GitHub workflow, they help developers collaborate on projects simultaneously. If you've never heard of them that's okay. My goal in this tutorial is to help you understand what they are and how they are used when working on repositories.

What is the difference between pull and pull request in git?

The term pull is used to receive data from GitHub. It fetches and merges changes from the remote server to your working directory. The git pull command is used to pull a repository. Pull request is a process for a developer to notify team members that they have completed a feature.

What is the difference between a pull request and a commit?

A commit is a discrete change to one or more files. It is a critical part of Git. A pull request is a request to merge one or more commits into a different branch. It is not part of Git; it is only part of GitHub (and similar services like BitBucket).


2 Answers

A pull request signals that you want some changes in your branch merged to a target branch.

One example might be that you make a new branch "my-feature" based on the current development branch (say, "master"). When you are done, you can push your branch to the remote repo and create a pull request from "my-feature" to "master". The pull request gives people an opportunity to review the change and comment, and you may push additional changes on the same branch in response to feedback which will be updated in the pull request. When the code is good to merge, someone can then apply the merge to master and the pull request is closed.

You can of course merge branches without first creating a pull request, but the benefit of pull requests comes for collaboration. In Stash, you can configure who can merge to which branches, and require a certain number of passing builds or approvals before the merge can be done. In a team environment such a workflow helps improve code quality and developer speed.

like image 114
Rog Avatar answered Oct 11 '22 14:10

Rog


Pull requests let you tell others about changes you've pushed to a GitHub repository. Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary.

A separate version of the code is BRANCH

like image 39
Rahul Tripathi Avatar answered Oct 11 '22 12:10

Rahul Tripathi