【发布时间】:2020-08-28 09:58:21
【问题描述】:
我确实在 Git 上创建了一个远程仓库 ('myRepo')。 我选中了“添加 READ.me”复选框,该复选框也对此“myRepo”存储库进行了提交。
然后我创建了一个新文件夹,在其中添加了一些文件并做了:
git init
git add .
git commit -m "init"
git remote add origin https://github.com/jozinho947/myRepo.git
# get the READ.me fetched on the 'origin/master' branch locally
git fetch
# get the READ.me merged in my local 'master' where i'm pointing
git merge origin/master
然后我有这个错误:
fatal: refusing to merge unrelated histories
我不明白为什么我不能这样做...... 有人可以帮我吗?
【问题讨论】:
-
在没有现有仓库的情况下先尝试克隆它。当你创建一个新的仓库时,它有不同的历史,所以 git 拒绝在你说没问题的情况下将两者结合起来。
-
你可以通过允许不相关的历史来说没关系。
标签: git github git-merge git-fetch