Git-创建请求请求而不进行分叉 [英] Git - Creating pull request without forking

查看:43
本文介绍了Git-创建请求请求而不进行分叉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在开始使用git已有一段时间了.有很多关于git pull request的教程和解释.是什么动机等等?

Been working with git for some time now. There are plenty tutorials and explanations on git pull request. What is it's motivation and etc.

我遇到两种情况:

1.分叉git repo

我查看了一些公共git信息库,并决定自己要做出贡献,所以我:

I view some public git repository and decide that I want to contribute so I:

  1. 通过分叉创建重复的存储库.例如分支主管.

  1. Create a duplicate repository by Forking it. For example branch master.

进行我的更改并提交.

2.分支git repo

可以说我和我的团队成员正在从事此git repo的工作.我正在开发一项称为我的功能"的功能.因此,我执行以下操作:

Lets say me and my of my team members are working on this git repo. I working on a certain feature called 'my-feature'. So I do the following:

  1. 创建一个名为"my-feature"的新分支.
  2. 进行我的更改.然后提交.
  3. 创建拉取请求,同时选择"master"作为" base "分支,"my-feature"分支作为" compare
  4. "
  5. 提交拉取请求.
  1. Create a new branch called 'my-feature'.
  2. Make my changes. And commit.
  3. Create a pull request while selecting master for example as base branch and 'my-feature' branch as compare
  4. Submit the pull request.

就像我说的那样,我理解上面示例中的拉取请求的工作方式.

Like I said, I understand the way pull requests work in the above examples.

我的问题:镜像

但是,我正在处理一个任务,在该任务中明确要求我不是仓库的仓库,而是要镜像它.

Yet, I'm working on an assignment in which I was explicitly requested not the fork the repo but to mirror it.

我按照以下链接提供的github帮助上列出的步骤进行操作:

I followed the procedure listed on the github help supplied by the following link:

https://help.github.com/articles/duplicating-a-存储库/

基本上我所做的是:

创建公共存储库的裸克隆:

create a bare clone of the public repository:

 git clone --bare https://github.com/exampleuser/old-repository.git

镜像推送到新的存储库(在我的github帐户上)

mirror push to new repository ( which is on my github account)

cd old-repository.git
git push --mirror https://github.com/exampleuser/new-repository.git

我进行了更改并将它们提交到我自己的镜像副本中.现在如何在不分叉的情况下创建向存储库所有者的拉取请求?

I made my changes and committed them to my own mirrored copy. Now how do I create a pull request to the owner of the repository without forking it?

推荐答案

正如您已经指出的那样,只有两种方法可以创建请求请求:从fork或具有对原始存储库的贡献者访问权限.如果您都没有,那您​​就不走运了.

As you already pointed out, there are only two ways that allow you to create pull requests: Either from a fork or when you have contributor access to the original repository. If you have neither, then you’re out of luck here.

您唯一能做的就是创建一个问题并请求拉动(这是一种非常手动的拉动请求).

The only thing you could do is create an issue and ask for a pull (which is kind of a very manual pull request).

有关GitHub命令行界面 hub 的一个相关问题,要求找到一种方法来

There is a related issue about GitHub’s command line interface hub, asking for a way to submit a pull request without a fork. The comments there discuss how this would work, and various members point out that it won’t be possible without a fork:

j1z0 :如果您不推送权限,则必须使用派生,因为GitHub中的权限是每个存储库中的权限,而不是每个分支中的权限.

j1z0: If you don't push rights you have to use a fork because the permissions in GitHub are per repo not per branch.

米斯拉夫:如果您具有对原始存储库的推送访问权限,那么只有在没有派生的情况下才可以打开拉取请求.然后,您可以简单地推送到该存储库中的新分支,并使用 hub pull-request .

在其他情况下,您必须使用 hub fork 创建一个fork并推送到新的远程 git push -u skywinder HEAD 并打开请求请求 hub拉取请求.

In other cases, you must create a fork with hub fork and push to the new remote git push -u skywinder HEAD and open a pull request hub pull-request.

这篇关于Git-创建请求请求而不进行分叉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆