gpt4 book ai didi

git - 将提交推送到已打开 pull 请求的另一个用户的分支

转载 作者:太空狗 更新时间:2023-10-29 14:36:27 25 4
gpt4 key购买 nike

我在 github 上有一个仓库。我的存储库由另一个用户 fork 。现在他提出了一个pull request。我想将我的一个提交推送到他的功能分支(他已经为此提出了 PR)。这可能吗。

这是我做的

git pull remote-ref-other-user feature-branch

完成此操作后,我可以提取他的提交。但是当我做一些更改时,添加另一个提交并尝试以这种方式推送它。

git push remote-ref-other-user feature-branch

我收到这个错误

error: src refspec feature-branch does not match any.
error: failed to push some refs to 'https://github.com/other-user/repo'

Is it possible to push a commit from my side to his branch. If yes then how can it be done.

最佳答案

假设您添加他的存储库,说“mysamplerepository”,作为远程​​:

git remote add johnrepo https://github.com/john/mysamplerepository

您的分支名为 tweaks .

如果您想将更改推送到名为 master 的分支在他的存储库中,你会这样做:

git push <remote-name> <source-ref>:<target-ref>

或者在这个例子中:

git push johnrepo refs/heads/tweaks:refs/heads/master

请记住,您还需要具有写入权限(推送权限)才能推送到他的存储库。您可以在 Github's documentation 上阅读更多相关信息.

关于git - 将提交推送到已打开 pull 请求的另一个用户的分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42563008/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com