git 拉取请求和分支有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19059838/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What's the difference between a Pull Request and a branch?
提问by SkyWalker
In the context of GitHuband 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?
在GitHub和Atlassian Stash的上下文中,有一个共同的特性来执行拉取请求。拉取请求和分支有什么区别?拉取请求看起来像是调用分支的不同方式,或者?
采纳答案by Rahul Tripathi
Pull requestslet 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.
拉取请求可让您告诉其他人您已推送到 GitHub 存储库的更改。发送拉取请求后,感兴趣的各方可以查看更改集,讨论潜在的修改,甚至在必要时推送后续提交。
A separate version of the code is BRANCH
代码的一个单独版本是BRANCH
回答by Rog
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.
一个例子可能是您基于当前的开发分支(例如“master”)创建了一个新分支“my-feature”。完成后,您可以将分支推送到远程存储库并创建从“my-feature”到“master”的拉取请求。拉取请求为人们提供了更改和评论的机会,您可以在同一分支上推送其他更改以响应将在拉取请求中更新的反馈。当代码可以合并时,有人可以将合并应用到 master 并关闭拉取请求。
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.
您当然可以在不先创建拉取请求的情况下合并分支,但是拉取请求的好处来自于协作。在 Stash 中,您可以配置谁可以合并到哪些分支,并且需要一定数量的通过构建或批准才能完成合并。在团队环境中,这样的工作流程有助于提高代码质量和开发人员速度。
回答by AlbertEngelB
A branch is just a separate version of the code.
分支只是代码的一个单独版本。
A pull request is when someone take the repo, makes their own branch, does some changes, then tries to merge that branch in (put their changes in the other person's code repository). (In the most general of terms.)
拉取请求是指当有人使用 repo,创建自己的分支,进行一些更改,然后尝试合并该分支(将他们的更改放入其他人的代码存储库中)。(用最一般的术语来说。)
回答by Michael Freidgeim
There are a few workflows, that describe process how developers using git. One of them is Feature Branch Workflow
有一些工作流描述了开发人员如何使用 git 的过程。其中之一是功能分支工作流
The core idea behind the Feature Branch Workflow is that all feature development should take place in a dedicated branch instead of the master branch.
Encapsulating feature development also makes it possible to leverage pull requests. Detailed example can be found at Feature Branches and Pull Requests : Walkthrough
Feature Branch Workflow 背后的核心思想是所有功能开发都应该在专用分支而不是 master 分支中进行。
封装功能开发还可以利用拉取请求。详细示例可以在功能分支和拉取请求中找到:演练
There is a similar GitHub Standard Fork & Pull Request Workflow( or just Pull request workflow), where instead of creating a branch inside your own repository you create a fork from someone else repository.
有一个类似的GitHub Standard Fork & Pull Request Workflow(或只是Pull request 工作流),其中不是在您自己的存储库中创建分支,而是从其他存储库创建一个分支。
Some people do not distinguish these concepts and use terms “feature branch workflow” and “pull request workflow” interchangeably. It can be confusing for others.
有些人不区分这些概念,将术语“功能分支工作流”和“拉取请求工作流”互换使用。这可能会让其他人感到困惑。