git 拉请求而不分叉?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14821583/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 15:29:08  来源:igfitidea点击:

Pull request without forking?

gitgithubforkrepository

提问by Jasper

Here are steps of code contribution from the topic "How do I contribute to other's code in GitHub?"

以下是主题“如何为 GitHub 中的其他人的代码做出贡献?”的代码贡献步骤。

  1. Fork the project
  2. Make one or more well commented and clean commits to the repository. You can make a new branch here if you are modifying more than one part or feature.
  3. Perform a pull request in github's web interface.
  1. 分叉项目
  2. 对存储库进行一次或多次评论良好且干净的提交。如果您要修改多个零件或特征,您可以在此处创建一个新分支。
  3. 在 github 的 Web 界面中执行拉取请求。

Is it possible to make a pull request without forking a repo?

是否可以在不分叉回购的情况下提出拉取请求?

It's quite sad to see more than 20 repos in my account which were forked for some pull requests. They have no activity then and zero stars / followers. Looks like I'm just copying somebody's code for a black day.

在我的帐户中看到 20 多个 repos 是为一些拉取请求分叉的,这让我感到非常难过。他们当时没有活动,零星/追随者。看起来我只是为了黑色的一天复制某人的代码。

采纳答案by Ryan Bigg

If you don't have access to create branches on that repository, there is no way to create a pull request without forking.

如果您无权在该存储库上创建分支,则无法在没有 fork 的情况下创建拉取请求

回答by VonC

Once your pull requests are accepted, you can safely delete the repo.

一旦您的拉取请求被接受,您就可以安全地删除 repo

Afterwards, simply clone directly from the original upstream repo.

之后,只需直接从原始上游 repo 克隆。

If you have other pull requests to make, then you should make them in their own respective branch, which means you can safely delete the branch you made to manage an accepted pull request (as in "My pull request has been merged, what to do next?")

如果您有其他拉取请求要发出,那么您应该在它们各自的分支中创建它们,这意味着您可以安全地删除您为管理接受的拉取请求而创建的分支(如“我的拉取请求已被合并,该怎么办”下一个?”)

回答by Todd A. Jacobs

By definition, a pull request involves a fork unless you have commit access to the destination repository. You can do a couple of things, though:

根据定义,除非您对目标存储库具有提交访问权限,否则拉取请求涉及分叉。不过,您可以做几件事:

  1. If you dohave commit access, create a branch and make your pull request against the new branch.
  2. Post your patch in the body of an issue. This isn't really the GitHub way, but it certainly works.
  3. Fork a repository, create a pull request, and then delete the fork once the pull request is merged or declined.
  1. 如果您确实有提交访问权限,请创建一个分支并针对新分支发出拉取请求。
  2. 在问题正文中发布您的补丁。这并不是真正的 GitHub 方式,但它确实有效。
  3. Fork 一个仓库,创建一个 pull request,然后在 pull request 被合并或拒绝后删除 fork。

If you're just trying to avoid keeping repositories around that you aren't actively using, I personally suggest option #3. It sticks to the accepted GitHub workflow without cluttering up your dashboard.

如果您只是想避免保留您没有积极使用的存储库,我个人建议使用选项 #3。它坚持公认的 GitHub 工作流程,而不会弄乱您的仪表板。

回答by Ya Zhuang

github supports Shared Repository Model

github 支持共享仓库模型

The Shared Repository Model is more prevalent with small teams and organizations collaborating on private projects. Everyone is granted push access to a single shared repository and topic branches are used to isolate changes.

Pull requests are especially useful in the Fork & Pull Model because they provide a way to notify project maintainers about changes in your fork. However, they're also useful in the Shared Repository Model where they're used to initiate code review and general discussion about a set of changes before being merged into a mainline branch.

共享存储库模型在小型团队和组织在私人项目上进行协作时更为普遍。每个人都被授予对单个共享存储库的推送访问权限,并且主题分支用于隔离更改。

拉取请求在 Fork & Pull 模型中特别有用,因为它们提供了一种方法来通知项目维护者您的 fork 中的更改。但是,它们在共享存储库模型中也很有用,它们用于在合并到主线分支之前启动代码和关于一组更改的一般讨论。

回答by Anona112

You still need that one-liner: hub fork;git push -u $GIT_USER HEAD;hub pull-request

你仍然需要那个单线: hub fork;git push -u $GIT_USER HEAD;hub pull-request