git request-pull 从本地分支到远程 master
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26613329/
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
git request-pull from local branch to remote master
提问by Guillaume Vincent
I really love the github pull-request method for collaboration on distributed software development. It allows discussion and code review.
我真的很喜欢用于分布式软件开发协作的 github pull-request 方法。它允许讨论和代码。
My goal is to use the same flow but inside our repository without github. I don't want to fork the project.
我的目标是使用相同的流程,但在我们的存储库中没有 github。我不想分叉这个项目。
Lets imagine, I develop an awesome feature locally. And I want to make a pull request on my master branch to force code review.
让我们想象一下,我在本地开发了一个很棒的功能。我想在我的主分支上发出拉取请求以强制代码。
A---B---C feature/awesomeFeature
/
D---E---F---G origin/master
master
is it possible to make a pull request on origin/master ?
是否可以在 origin/master 上发出拉取请求?
I tried git request-pull feature/awesomeFeature origin
without any success
我试过git request-pull feature/awesomeFeature origin
没有任何成功
回答by ArnaudR
If you developed your feature branch locally, you just have to use:
如果您在本地开发了功能分支,则只需使用:
git request-pull origin/master feature/awesomeFeature
git request-pull origin/master feature/awesomeFeature
This will only give you a summary of the changes. If you want every detail, remember to add -p
(for patch) to your command line.
这只会为您提供更改的摘要。如果您想要每个细节,请记住将-p
(用于补丁)添加到您的命令行。
回答by Adam H
Pull requests aren't actually implemented within git itself, so you will need another system to sit on top of git. If you want to host your repository yourself, you can use software such as GitLabto manage your repo and allow you to make pull requests.
拉取请求实际上并未在 git 本身内实现,因此您需要另一个系统来位于 git 之上。如果您想自己托管您的存储库,您可以使用GitLab等软件来管理您的存储库并允许您发出拉取请求。
回答by VonC
is it possible to make a pull request on
origin/master
?
是否可以提出拉取请求
origin/master
?
As long as origin/master
is a valid branch, yes.
只要origin/master
是一个有效的分支,就可以。
But with Git 2.23 (Q3 2019) "git request-pull
" learned to warn when the ref we ask them to pull from in the local repository and in the published repository are different.
但是在 Git 2.23(2019 年第 3 季度)中,“ git request-pull
”学会了在我们要求他们从本地存储库和已发布存储库中提取的引用不同时发出警告。
See commit 0454220, commit 5731dfc(28 May 2019) by Paolo Bonzini (bonzini
).
(Merged by Junio C Hamano -- gitster
--in commit dedc046, 17 Jun 2019)
请参阅Paolo Bonzini ( ) 的commit 0454220和commit 5731dfc(2019 年 5 月 28 日)。(由Junio C Hamano合并-- --在dedc046 提交中,2019 年 6 月 17 日)bonzini
gitster
request-pull
: warn if the remote object is not the same as the local oneIn some cases,
git request-pull
might be invoked with remote and local objects that differ even though they point to the same commit.
For example, the remote object might be a lightweight tag vs. an annotated tag on the local side; or the user might have reworded the tag locally and forgotten to push it.When this happens
git-request-pull
will not warn, because it only checks that "git ls-remote
" returns an SHA1 that matches the local commit (known as$headrev
in the script).This patch makes
git-request-pull
retrieve the tag object SHA1 while processing the "git ls-remote
" output, so that it can be matched against the local object.
request-pull
: 如果远程对象与本地对象不同,则发出警告在某些情况下,
git request-pull
可能会使用不同的远程和本地对象调用,即使它们指向相同的提交。
例如,远程对象可能是轻量级标签与本地端的带注释标签;或者用户可能在本地改写了标签并忘记推送它。发生这种情况
git-request-pull
时不会发出警告,因为它只检查“git ls-remote
”返回与本地提交($headrev
在脚本中称为)匹配的 SHA1 。此补丁
git-request-pull
在处理“git ls-remote
”输出时检索标签对象 SHA1 ,以便它可以与本地对象进行匹配。