为什么 git 'pull request' 不称为 'push request'?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21657430/
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
Why is a git 'pull request' not called a 'push request'?
提问by Alejandro Sanz Díaz
The terminology used to merge a branch with an official repository is a 'pull request'. This is confusing, as it appears that I am requesting to push my changes to the official repository.
用于将分支与官方存储库合并的术语是“拉取请求”。这令人困惑,因为我似乎要求将我的更改推送到官方存储库。
Why is it called a pull request and not a push request?
为什么它被称为拉取请求而不是推送请求?
采纳答案by Sven
If you have a code change in your repository, and want to move it to a target repository, then:
如果您的存储库中有代码更改,并希望将其移动到目标存储库,则:
- "Push" is you forcing the changes being present in the target repository (
git push
). - "Pull" is the target repository grabbing your changes to be present there (
git pull
from the other repo).
- “推送”是您强制目标存储库 (
git push
) 中存在的更改。 - “Pull”是目标存储库,它将您的更改抓取到那里(
git pull
来自另一个存储库)。
A "pull request" is you requesting the target repository to please grab your changes.
“拉取请求”是您请求目标存储库获取您的更改。
A "push request" would be the target repository requesting you to push your changes.
“推送请求”将是请求您推送更改的目标存储库。
回答by JB Nizet
When you send a pull request, you're asking (requesting) the official repo owner to pull some changes from your own repo. Hence "pull request".
当您发送拉取请求时,您是在要求(请求)官方存储库所有者从您自己的存储库中提取一些更改。因此“拉取请求”。
回答by Honey
tl;dr since I am not allowed to make a push, I'll just nicely make a request to the repo owner so they decide to pull
tl;dr 因为我不允许推送,所以我会很好地向 repo 所有者提出请求,所以他们决定拉
Who can push code to a repository?
谁可以将代码推送到存储库?
Should anyone (possibly evil or uneducated or unknown) be able to come and say here I just pushed this to your master branch and messed up all your code HAHAHA!?
如果有人(可能是邪恶的或未受过教育的或未知的)能够来这里说我只是将其推送到您的主分支并弄乱了您的所有代码哈哈哈!?
Surely you don't want him to do that. By default a safety net is set so no one can push to your repo. You canset others as a collaborator, then they can push. You would give such access to people you trust.
你肯定不想让他那样做。默认情况下,设置了一个安全网,因此没有人可以推送到您的存储库。您可以将其他人设置为协作者,然后他们就可以推送了。你会给你信任的人这样的访问权限。
So if you're not a collaborator and try to push, you will get some error indicating you don't have permission.
因此,如果您不是协作者并尝试推送,您将收到一些错误,表明您没有权限。
So how can other developers push to a repo they are not given permission to push?
You can't give access to everyone, yet you want to give othersan outlet/entry point so they can make 'a request to the repo owner to pullthis code into the repo'. Simply put by making the repo accessible, they can fork it...make their changes in their own fork. Pushtheir changes to their own fork. Once it's in their in their own remote repo:
那么其他开发人员如何推送到他们没有推送权限的存储库呢?
您无法向所有人授予访问权限,但您想为其他人提供一个出口/入口点,以便他们可以“向仓库所有者提出请求,将代码拉入仓库”。简单地说,通过使 repo 可访问,他们可以分叉它……在他们自己的分叉中进行更改。将他们的更改推送到他们自己的分支。一旦它在他们自己的远程仓库中:
They make a pull requestfrom their fork and the owner of the upstream repo (which you can't push directly to) will decide whether or not to merge the pull request.
他们从他们的分支发出拉取请求,上游存储库的所有者(您不能直接推送到)将决定是否合并拉取请求。
Also a semi-related question I recommend reading What exactly happens in a git push? Why isn't a git push considered just like a git merge?
还有一个半相关的问题,我建议阅读git push 中究竟发生了什么?为什么 git push 不像 git merge 那样被考虑?
回答by hepidad
Pull Request: I Requestto you to Pullmine.
拉请求:我请求你拉我的。
回答by user11705414
I want to push something to someone else's repo.
我想把一些东西推送到别人的仓库。
I do not have the permission to push (or pull, for that matter).
我没有推(或拉,就此而言)的许可。
The owner/collaborators has permissions. They can pull as well as push. I cannot push.
所有者/合作者具有权限。他们可以拉也可以推。我推不动。
So, I request them to perform a pull from me - which indirectly means that I am requesting them to accept my push.
所以,我要求他们从我这里执行拉取操作——这间接意味着我要求他们接受我的推送。
So, no request for push. Only for a pull. And for acceptance of a push.
所以,没有推送请求。只为一拉。并接受推动。
Hence, a 'pull' request. And not a 'push' request.
因此,“拉”请求。而不是“推送”请求。
回答by Kyzer
It's the word "Request" that is key in these actions. You could also think of it as saying "I have a request for you to take my work, do you accept?" - "A Pull Request".
“请求”这个词是这些行动的关键。你也可以把它想成是“我有一个要求你接受我的工作,你接受吗?” - “拉取请求”。
It's slightly confusing at first, but makes sense eventually.
起初有点令人困惑,但最终是有道理的。
回答by SPidey
To understand this better and remember it forever, you need to picture it.
为了更好地理解这一点并永远记住它,您需要对其进行描绘。
Picture a big, living tree {as your repository}. The tree is too sturdy for you to push a branch into in or add a new part into it {symbolizes creating a new branch or you pushing code in it}, instead you must ask the tree to pull a branch into the trunk or have the changes from you.
想象一棵活生生的大树{作为您的存储库}。这棵树太坚固了,你无法将一个分支推入其中或向其中添加一个新部分{象征着创建一个新分支或您将代码推入其中},相反,您必须要求树将一个分支拉入树干或让从你那里改变。
The term “pull requests” comes from the distributed nature. Instead of just pushing your changes into the repository (like you would do with a centralized repository, e.g. with Subversion), you are publishing your changes separately and ask the maintainer to pull in your changes. The maintainer then can look over the changes and do said pull.
“拉取请求”一词来自分布式特性。而不是仅仅将您的更改推送到存储库(就像您使用集中式存储库所做的那样,例如使用 Subversion),您将单独发布您的更改并要求维护者拉入您的更改。然后维护者可以查看更改并执行所述拉取操作。
So you basically "request" the guys with writing access to the repo you want to contribute to, to "Pull" from your repo.
所以你基本上“请求”那些对你想要贡献的仓库有写访问权限的人,从你的仓库“拉”出来。
Pull requests let you tell others about the changes you've pushed to a branch in a repository on GitHub. 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. Github Explanation
拉取请求可让您告诉其他人您已推送到 GitHub 上存储库中的分支的更改。打开拉取请求后,您可以与合作者讨论和潜在的更改,并在您的更改合并到基础分支之前添加后续提交。 Github说明
回答by jimmymathews
I'm afraid that most of these answers address the question What does 'pull request' mean?or What would 'push request' mean?rather than the OP's question: Whyis it called a pull request and not a push request?
恐怕这些答案中的大多数都解决了“拉取请求”是什么意思的问题?或“推送请求”是什么意思?而不是 OP 的问题:为什么将其称为拉取请求而不是推送请求?
Normally this sort of question-replacement is acceptable, but in this case it is clear that the OP knows the answers to these replacement questions, so answering them is not very helpful.
通常这种替换问题是可以接受的,但在这种情况下,很明显 OP 知道这些替换问题的答案,因此回答它们并不是很有帮助。
Only the people at GitHub that coined the term know for sure. However it seems evident that this terminological choice reflects something like the following viewpoint concerning the phenomenon of "changes coming in to a repository from outside": The maintainer does the action (pull).
只有 GitHub 上创造这个词的人肯定知道。然而,这个术语选择似乎很明显反映了类似于以下关于“更改从外部进入存储库”现象的观点:维护者执行操作(拉)。
However, a request is also an action, and the doer of that action is not the maintainer but rather the submitter (who has done even more action, namely work). Thus the term 'pull request' creates confusion about who the agent is. Ultimately the confusion arises because of the recursive nature of a request: A request is both an action by a primary agent and a request for a future action by a second agent.
然而,一个请求也是一个动作,那个动作的执行者不是维护者而是提交者(他做了更多的动作,即工作)。因此,术语“拉取请求”会造成对代理是谁的混淆。由于请求的递归性质,最终会出现混淆:请求既是主要代理的操作,也是第二代理对未来操作的请求。
The situation is quite analogous to now-common linguistic constructs like "we built our house" (used in place of "we paid someone else to build our house"), in that responsibility for the primary action is shifted from the obvious original agent to a secondary agent fulfilling a managerial social role.
这种情况非常类似于现在常见的语言结构,例如“我们建造了我们的房子”(用于代替“我们花钱请别人来建造我们的房子”),因为主要行动的责任从明显的原始代理人转移到履行管理社会角色的二级代理人。
One might conclude from this that the reason for the terminological choice is legitimization of the viewpoint that managerial work is first-class labor. Moreover the reason for confusionabout this terminological choice may be that non-manager workers naturally have a different viewpoint.
可以由此得出结论,术语选择的原因是管理工作是一等劳动的观点的合法化。此外,对这个术语选择感到困惑的原因可能是非经理员工自然有不同的观点。
回答by Michael Pauli
I think its a silly terminology because I want to think that Iwant to PUSH something to you and not thinking vice versa asking someone else to pull mine addings. Therefore it should be changed into PUSH REQ. since I'm the active part. The arrow goes the other way starting with me and not the Goofy in the other end. IMHO.
我认为这是一个愚蠢的术语,因为我想认为我想向你推送一些东西,而不是反过来想要求其他人拉我的添加。因此应改为PUSH REQ。因为我是主动的。箭头从我开始,而不是另一端的高飞。恕我直言。
回答by Jin Lim
Think This way.Local repositoryvs Remote repository.
这样想。本地存储库与远程存储库。
- When you Pushfrom Local. (
git push
) - in other words, the Remote repository is Pullingcodes from you(Local).
- 当您从本地推送时。(
git push
) - 换句话说,远程存储库正在从您(本地)拉取代码。
You are requesting something. So, ask your self,
你在请求一些东西。所以,问问你自己,
- Do you want Remote repository Pullingcodes from you? - Pull Request.
- 你想要远程存储库从你那里拉取代码吗?-拉取请求。