本文介绍了如何从叉子中检出PR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用github托管一些项目,有人分叉了我的仓库并提交了公关,我以前从未用叉子测试过公关.如何检出分支并进行测试?我可以一些如何将其放入我的回购中吗?还是我签出fork并以这种方式测试分支?

I'm using github to host some projects and someone forked my repo and submitted a pr, I have never had to test a pr in a fork before. How can I checkout the branch and test it? Can I some how pull it into my repo? Or do I checkout the fork and test the branch that way?

推荐答案

有几种不同的方法,但我将介绍在这种情况下的处理方法

There are a couple different ways but I’ll go over what I would do in this situation

git remote add<无论您要调用什么远程名称><链接到分叉>

此处是文档.这将允许您从fork中添加和签出远程分支.在检查您描述的工作流程中的PR时,我通常会执行 git clean -dfx (警告:这是非常密集清理,它消除了您的未进行的分阶段工作), git remote add<无论您要调用什么远程名称><链接到fork> 和 git checkout< branch name> .

Here is the documentation. This will allow you to add and check out the remote branch from the fork. When reviewing PRs in the workflow you described I usually do a git clean -dfx (warning: this is a very intensive clean that gets rid of unstaged work you have), git remote add <whatever you want the remote to be called> <link to the fork>, and git checkout <branch name>.

如果它已经在您的仓库中,则可以使用 git branch -a 看到它,然后像其他情况一样简单地将其检出.

If it’s in your repo already you can see that with git branch -a and simply check it out as you might otherwise.

这篇关于如何从叉子中检出PR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 17:35
查看更多