为什么git的“ pull request”不称为“ push request”?

本文翻译自:Why is a git 'pull request' not called a 'push request'?

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? 为什么将其称为拉取请求而不是推入请求?


#1楼

参考:https://stackoom.com/question/1Ss5O/为什么git的-pull-request-不称为-push-request


#2楼

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". 因此“拉请求”。


#3楼

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 ). “ Push”是您强制目标存储库中存在更改( git push )。
  • "Pull" is the target repository grabbing your changes to be present there ( git pull from the other repo). “ 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. “推送请求”将是请求您推送更改的目标存储库。


#4楼

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. 起初有点令人困惑,但最终还是有道理的。


#5楼

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,因为不允许我进行推送,所以我会很好地向回购所有者发出请求,以便他们决定撤回


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! 如果有人(可能是邪恶的,未受过教育的或未知的)可以来这里说我只是将其推送到您的master分支,并弄乱了您所有的代码,哈哈! ?

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 can set 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 others an outlet/entry point so they can make 'a request to the repo owner to pull this code into the repo'. 你不能给任何人访问,但你想给别人一个出口/入口点,使他们能够做出“以回购业主的要求来这个代码进入回购”。 Simply put by making the repo accessible, they can fork it...make their changes in their own fork. 简单地说,通过使存储库易于访问,他们就可以对其进行分叉...在自己的分叉中进行更改。 Push their changes to their own fork . 自己的更改自己的叉子上 Once it's in their in their own remote repo: 一旦进入他们自己的远程仓库中:

They make a pull request from 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? 我也建议阅读一个半相关的问题,git push到底会发生什么? Why isn't a git push considered just like a git merge? 为什么不像git merge一样考虑git push?


#6楼

拉取要求:我要求拉取我的。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值