git 将另一个远程分支合并到我的分支后,没有为我的分支提取任何跟踪信息
git pull no tracking info for my branch after merging a branch from another remote to my branch
我和我的同事 forked
有一个名为 main_repo
的存储库。因此,我的同事在她的叉子上创建了一个名为 new_changes
的分支,并从我的名为 my_branch
的分支中分支出来并进行了新的更改。昨天我使用合并按钮将她对她分支的拉取请求合并到我在 stash 上的分支。
在她的 pull request 页面上它说 MERGED her_fork_repo new_changes
到 my_branch
提交 1234
。假设我 git pull
在我的 intellij 分支上我会看到我同事的新更改,而是显示:
There is no tracking information for the current branch.
Please specify which branch you want to rebase against.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> my_branch
在我的分支中,当我输入 git remote
时,它显示 origin
。我也尝试过 git pull origin my_branch
,但 git 显示 Already up to date
。
并且从 my_branch
的拉取请求页面(合并到 main_repo
),我也没有看到新的更改,我应该怎么做才能反映新的更改我的分支?
On her pull request page it says MERGED her_fork_repo new_changes to my_branch in commit 1234
PR 可以在同一个仓库的两个分支之间,也可以在一个 fork 仓库的分支和被 fork 的上游原始仓库之间。
如果你的同事 PR 被合并了,确保它 where: 它在原始上游存储库中,你需要将那个上游远程 URL 添加到您自己的本地克隆,以便能够获取 "commit 1234".
cd /path/to/local/clone/of/my/fork
git remote add upstream https://url/upstream/original/repository
git fetch upstream
git merge upstream/my_branch
感谢@VonC
这让我意识到我合并了我同事的 PR,它指向 main_repo
而不是我的 fork 仓库。所以现在在 main_repo
和我的 fork 仓库上,有一个同名的分支 my_branch
。我做的是我
git remote add main https://git-link-for-main-repo
git pull main my_branch
然后修复所有合并冲突
git add src/main/resources/conflicted_file.py
git commit
git push origin my_branch
我和我的同事 forked
有一个名为 main_repo
的存储库。因此,我的同事在她的叉子上创建了一个名为 new_changes
的分支,并从我的名为 my_branch
的分支中分支出来并进行了新的更改。昨天我使用合并按钮将她对她分支的拉取请求合并到我在 stash 上的分支。
在她的 pull request 页面上它说 MERGED her_fork_repo new_changes
到 my_branch
提交 1234
。假设我 git pull
在我的 intellij 分支上我会看到我同事的新更改,而是显示:
There is no tracking information for the current branch. Please specify which branch you want to rebase against. See git-pull(1) for details. git pull <remote> <branch> If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/<branch> my_branch
在我的分支中,当我输入 git remote
时,它显示 origin
。我也尝试过 git pull origin my_branch
,但 git 显示 Already up to date
。
并且从 my_branch
的拉取请求页面(合并到 main_repo
),我也没有看到新的更改,我应该怎么做才能反映新的更改我的分支?
On her pull request page it says MERGED her_fork_repo new_changes to my_branch in commit 1234
PR 可以在同一个仓库的两个分支之间,也可以在一个 fork 仓库的分支和被 fork 的上游原始仓库之间。
如果你的同事 PR 被合并了,确保它 where: 它在原始上游存储库中,你需要将那个上游远程 URL 添加到您自己的本地克隆,以便能够获取 "commit 1234".
cd /path/to/local/clone/of/my/fork
git remote add upstream https://url/upstream/original/repository
git fetch upstream
git merge upstream/my_branch
感谢@VonC
这让我意识到我合并了我同事的 PR,它指向 main_repo
而不是我的 fork 仓库。所以现在在 main_repo
和我的 fork 仓库上,有一个同名的分支 my_branch
。我做的是我
git remote add main https://git-link-for-main-repo
git pull main my_branch
然后修复所有合并冲突
git add src/main/resources/conflicted_file.py
git commit
git push origin my_branch