致命:在添加git remote之后拒绝合并不相关的历史记录

时间:2018-05-01 03:40:21

标签: git github

我已将远程存储库添加到我正在使用的文件夹中:

git remote add origin https://github.co/<username>/<repo>.git

如果我输入:

git pull origin master

我明白了:

From https://github.co/<username>/<repo>
    * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories

我也尝试过:

$ git pull origin master --allow-unrelated-histories

但我明白了:

From https://github.com/...
    * branch            master     -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
    <files>
Please commit your changes or stash them before you merge.
Aborting

1 个答案:

答案 0 :(得分:38)

您需要首先.f.canvas bind all <3> { puts stderr [%W find closest %x %y] } reset进行更改:

commit

或:

git reset --hard

然后你可以这样做:

git commit -m "saving changes..."