git 如何使用 EGit 发出拉取请求?

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

How do I make a pull request using EGit?

eclipsegitgithubopen-sourceegit

提问by Daniel Paczuski Bak

I have a local master branch and I want to create a pull request with a repo owned by somebody else. When I attempt to "push branch", I get the following text: "can't connect to any URL: https://github.com/jleclanche/fireplace: git-receive-pack not permitted"

我有一个本地主分支,我想使用其他人拥有的仓库创建一个拉取请求。当我尝试“推送分支”时,我收到以下文本:“无法连接到任何 URL:https: //github.com/jleclanche/fireplace:不允许 git-receive-pack”

I'm guessing that what I'm doing here is actually trying to merge, rather than making a request. How would I do this?

我猜我在这里所做的实际上是尝试合并,而不是提出请求。我该怎么做?

回答by Rüdiger Herrmann

These are the steps necessary to fork a repository, make changes and finally open a pull request to have the changes merged back into the originating repository.

这些是分叉存储库、进行更改并最终打开拉取请求以将更改合并回原始存储库所需的步骤。

  1. On GitHub, navigate to the repository's page and click the Forkbutton in the top-right corner of the page

  2. Copy the URL of the forked repository to create a local clone in EGit

  3. I recommend creating a new branch in the form your-name/issue-name. Working on a separate branch gives a better oversight and helps when working on multiple pull requests in parallel.

  4. Make one or more commitsthat should end up in a pull request.

  5. Pushthese changes to the forked repository.

  6. On GitHub, navigate to the fork's page. You should see a message there indicating that a new branch was created and a button to create a pull request. Click this button. On the next page, you can provide more information and finally confirm the creation of the pull request.

  1. 在 GitHub 上,导航到存储库页面并单击页面右上角的Fork按钮

  2. 复制分叉仓库的 URL 以在 EGit 中创建本地克隆

  3. 我建议在表单中创建一个新分支your-name/issue-name。在单独的分支上工作可以提供更好的监督,并有助于并行处理多个拉取请求。

  4. 进行一个或多个应以拉取请求结束的提交

  5. 这些更改送到分叉存储库。

  6. 在 GitHub 上,导航到 fork 的页面。您应该在那里看到一条消息,指示已创建一个新分支和一个用于创建拉取请求的按钮。单击此按钮。在下一页,您可以提供更多信息并最终确认拉取请求的创建。

In order to consume changes made to the originating repository, you would want to add it as a remoteto your local clone.

为了使用对原始存储库所做的更改,您需要将其作为远程添加到本地克隆。

You may even want to rename the remotes, so that the forked repository (the one you are pushing to) is named forkand for the originating repository use the default name origin.

您甚至可能想要重命名远程仓库,以便为分叉存储库(您要推送到fork的存储库)命名,并为原始存储库使用默认名称origin

For example:

例如:

[remote "fork"]
  url = [email protected]:your-name/forked-repo.git
  fetch = +refs/heads/*:refs/remotes/fork/*
[remote "origin"]
  url = [email protected]:user/originating-repo.git
  fetch = +refs/heads/*:refs/remotes/origin/*