git - 主分支无法使用 Git 从远程 pull

标签 git

我正在尝试将我的功能分支 rebase 到主分支。但是,当我尝试使用 git pull 或获取时,它甚至没有将 master 分支从远程 pull 到本地。

这是我尝试过的步骤

$ git merge origin/master
merge: origin/master - not something we can merge

$ git merge master
merge: master - not something we can merge      

$ git branch -r
origin/feature

 git branch -a
 * feature
  remotes/origin/feature


$ git fetch --all
Fetching origin

$ git pull --all
Fetching origin
Already up to date.

我通过以下方式克隆

git clone https://github.optum.com/<Repo details> --branch feature --single-branch

最佳答案

这是由于您使用 --single-branch 克隆的事实引起的,此更改器存储库配置将所有命令范围限制到远程的特定分支。 You can undo the command or add another branch as explained here .

git remote set-branches --add origin [remote-branch]
git fetch origin [remote-branch]:[local-branch]

关于git - 主分支无法使用 Git 从远程 pull ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58990860/

相关文章:

git - SVN 到 GIT 迁移并 merge 分支历史记录

iOS 核心数据 : "Data Model Version Compiler" error

eclipse - 使用 Aptana 安装 Git

windows - Git Bash 控制台在打开时崩溃

git - 删除我的 git 目录是否安全?克隆在错误的位置

git - 在git中,有没有一种简单的方法可以将不相关的分支引入到存储库中?

bash - 计算 git 存储库中的行数

java - 如何使用 egit/eclipse 配置工作区,以便我的更改转到 fork 上的分支

Git diff 到 HTML

git - 如何获取 git SHA 的关联引用路径?