gpt4 book ai didi

git push 到新的上游分支

转载 作者:行者123 更新时间:2023-12-03 08:45:29 24 4
gpt4 key购买 nike

我有一个存储库尚未与我想要将其推送到的存储库关联。审核通过后,我们准备在工作中提交征求意见。

首先,我添加了我想将其推送到的上游存储库:

git remote add upstream <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c1a6a8b581b2b2a9efa5a4b7efa0bbb4b3a4efa2aeac" rel="noreferrer noopener nofollow">[email protected]</a>:v3/place/projectgroup/repo

这是第一个也是唯一一个添加的上游,和之前一样它只存在于我的 Mac 上。然后我尝试添加上游:

$ git branch --set-upstream-to origin/candidate/1.0
error: the requested upstream branch 'origin/candidate/1.0' does not exist
hint:
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint:
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
$ git push -u origin/candidate/1.0 HEAD
fatal: 'origin/candidate/1.0' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我的问题是,如何使用尚不存在的上游名称将当前分支推送到远程存储库?

最佳答案

假设您位于 mybranch 分支。然后你说

git push -u upstream mybranch

这意味着:“获取我的本地 mybranch,将其推送到 upstream 远程(在那里它也将被称为 mybranch),同时,给我一个跟踪分支,它将充当本地 mybranch 和远程 mybranch 之间的链接。”

如果您希望远程名称与本地名称不同,请使用冒号语法,例如mybranch:remotebranch。 (你实际上可能不得不说mybranch:refs/heads/remotebranch,我对此有点困惑。)

关于git push 到新的上游分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61614432/

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