简体   繁体   English

如何使用 github UI 或通过命令行将来自主项目分支的拉取请求应用到我的分支?

[英]How can I apply a pull request from the main project branch to my fork using the github UI or via command line?

I wish to apply this pull request我希望应用此拉取请求

https://github.com/MonoGame/MonoGame/pull/5114 https://github.com/MonoGame/MonoGame/pull/5114

to https://github.com/Danthekilla/MonoGamehttps://github.com/Danthekilla/MonoGame

There doesn't seem to be a way to do this at first glance, is there a way to do it with TortoiseGit?乍一看似乎没有办法做到这一点,有没有办法用 TortoiseGit 做到这一点?

Perhaps some command like this?:也许是这样的命令?:

git merge https://github.com/Danthekilla/MonoGame https://github.com/MonoGame/MonoGame/pull/5114

You must specify the repository and branch to perform the pull request on when you originally create said pull request.当您最初创建所述拉取请求时,您必须指定存储库和分支来执行拉取请求。 AFAIK, there isn't any way to edit an existing pull request to do this. AFAIK,没有任何方法可以编辑现有的拉取请求来执行此操作。

From the GitHub web UI来自 GitHub 网页界面

  1. Go to the repo you want to pull from ( https://github.com/Jjagg/MonoGame )转到要从中提取的存储库 ( https://github.com/Jjagg/MonoGame )
  2. Select the branch that you want to pull ( getbackbufferdata )选择要拉取的分支( getbackbufferdata
  3. Click on New Pull Request点击新的拉取请求
  4. If the branch to pull onto does not appear at the top of the pull request creation page, then click on "compare across forks"如果要拉入的分支没有出现在拉取请求创建页面的顶部,则单击“跨分支比较”
  5. On the left, select the base repository and base branch which you want to pull onto在左侧,选择要拉入的基础存储库和基础分支
  6. Click View Pull Request单击查看拉取请求

From the command line从命令行

$ git checkout develop
$ git pull https://github.com/Jjagg/MonoGame/getbackbufferdata

( Caveat Emptor: I'm not 100% sure about the URL in the above command.) 警告 Emptor:我不是 100% 确定上述命令中的 URL。)

If you don't want to merge directly to the develop branch, you can create a temporary branch to merge to.如果不想直接合并到develop分支,可以创建一个临时分支合并到。 For example例如

$ git checkout -b jjagg/getbackbufferdata develop
$ git pull https://github.com/Jjagg/MonoGame/getbackbufferdata

If you often need to pull from a GitHub repo which belongs to a fellow contributor, you can create a remote for said repo如果您经常需要从属于其他贡献者的 GitHub 存储库中提取,您可以为该存储库创建一个远程

$ git remote add jjagg https://github.com/Jjagg/MonoGame

Now you can pull directly from this remote现在你可以直接从这个遥控器拉

$ git checkout -b jjagg/getbackbufferdata develop
$ git pull jjagg getbackbufferdata

All of this is a little easier with command-line completion.通过命令行完成,所有这些都变得容易一些。 Once the remote is added, you can type git pull j then push Tab to complete the remote name.添加远程后,您可以键入git pull j然后按 Tab 来完成远程名称。 Then after git pull jjagg g Tab again will complete the branch name.然后在git pull jjagg g Tab 之后再次完成分支名称。 If two branches start with g , then a double Tab will show all possible choices.如果两个分支以g开头,那么双选项卡将显示所有可能的选择。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过GitHub网站将原始仓库中的未合并拉取请求应用到我的fork中 - How to apply unmerged pull request from original repo into my fork via GitHub website git会从我的fork中将已删除的文件拉到github上的主项目吗? - Will git pull a deleted file from my fork to the main project on github? 如何通过对主项目的特定“拉”请求更新本地Forked Github项目? - How can I update my local Forked Github project by a certain Pull request to main project? 如何在没有在fork上创建分支的情况下从fork创建pull请求? - How can I create a pull request from a fork without having created a branch on the fork? 叉子的命令行拉取请求 - command line pull request from a fork 如何将拉取请求合并到我的github项目的功能分支中? - How do I merge a pull request into a feature branch of my github project? 如何在Git命令行中找到请求请求的源fork? - How do I find the source fork for a pull request from the Git command line? Github 从开发分支到主分支的拉取请求显示以前的提交。如何避免此类问题? - Github Pull Request from Develop branch to Master branch shows previous commits .How can I avoid such issues? git - 如何在我的本地计算机上获取在github上启动了拉取请求的分支名称? - git - How can I obtain the branch name from which a pull request was initiated on github, while on my local machine? 我正在尝试通过 git(命令行)从我的电脑中提取一个项目到 github。 但我无法从 github 获得链接 - I'm trying to pull a aproject from my pc via git (command line) to github. but I can't get the link from github
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM