git - Cannot pull with git
问题描述
We have a branch in our git repo called feature/TestBapi
.
I created a new remote connection to repository MyRepoA
: git remote add repo-A-branch ../MyRepoA
When i do git pull repo-A-branch feature/TestBapi --allow-unrelated-histories
i get :
fatal: Couldn't find remote ref feature/TestBapi
fatal: The remote end hung up unexpectedly
In my git config, i have :
branch.feature/TestBapi.remote=origin
branch.feature/TestBapi.merge=refs/heads/feature/TestBapi
To verify the existence of my branch, i did : git checkout --track origin/feature/TestBapi
. I get : fatal: A branch named 'feature/TestBapi' already exists.
I am stumped here. Any ideas?
解决方案
When you say
git pull repo-A-branch feature/TestBapi --allow-unrelated-histories
that means "on repo-A-branch
(which you've mapped to ../myRepoA
), find the branch named feature/TestBapi
; fetch it; and merge the result into my current branch.
As pointed out in multiple ways in the comments, the branch does not exist in ../myRepoA
.
When this is pointed out, you reply that the branch exists in the local repo, and/or that it exists at origin
. Which is fine, but it doesn't change the fact that it doesn't exist in the repo where you're telling git to look for it.
Perhaps you need to take a step back and review why you're trying to run this command. What are you expecting it to accomplish?
推荐阅读
- python - 如果语句正确,Python 不会检测到函数循环
- java - 如何使用他的包装类创建一个接受并返回泛型类型的方法
- file-upload - 将文件从 Blazor WebAssembly 应用程序直接上传到 Blob 存储
- python - MariaDB在python中检查连接状态
- python - 创建一个 Numpy 数据集
- javascript - Apexcharts 在工具提示中未显示正确的 x 值
- php - PHP 访问本地文件系统 -> 警告:stat(): stat failed for file:///.../test.txt
- datagridview - 如何避免 datagridrow 突出显示功能在 Null 上爆炸?
- .net - Sharepoint:从 .NET 应用程序中按文件名访问文件。超过 5000 个项目的问题。需要按文件“名称”列索引吗?
- docker - docker swarm 不会将任务分配给新的工作节点