如果我想从别人的 pull 请求中拉取代码而不必把他们的 fork 作为远程仓库添加,我可以执行以下命令:
我该如何对OP分支进行硬重置?
git pull https://github.com/<user>/<repo name>.git <branch name>
然而,如果存在合并冲突,则会失败,我希望能够只执行以下操作:
git reset --hard https://github.com/<user>/<repo name>.git/<branch name>
就像我通常所做的一样,例如:
git reset --hard upstream/master
然而这并不起作用,我得到了
fatal: invalid object name 'https'.
我该如何对OP分支进行硬重置?
git fetch https://github.com/<user>/<repo name>.git <branch name>
,但是我应该如何重置到该分支? - ignoring_gravitygit branch -a
命令以查看可用的分支。如果有任何 新的 分支进来,它会像origin/some_new_branch
这样显示。找到它,然后执行git reset --hard origin/some_new_branch
命令。 - Tim Biegeleisengit branch -a
,它不会出现在其中,很可能是因为我还没有将https://github.com/<user>/<repo name>.git
添加为远程仓库。如果我将其添加为远程仓库,那么就可以了。我只是想知道是否有一种方法可以在不添加新的远程仓库的情况下完成这个操作,因为我有很多来自许多不同人的 PR 需要审核。 - ignoring_gravity