git pull 出现
refusing to merge unrelated histories问题
,无法pull
$ git pull fatal: refusing to merge unrelated histories
查看帮助
$ git pull -help usage: git pull [<options>] [<repository> [<refspec>...]] -v, --verbose be more verbose -q, --quiet be more quiet --progress force progress reporting Options related to merging -r, --rebase[=<false|true|preserve|interactive>] incorporate changes by rebasing rather than merging -n do not show a diffstat at the end of the merge --stat show a diffstat at the end of the merge --log[=<n>] add (at most <n>) entries from shortlog to merge commi t message --squash create a single commit instead of doing a merge --commit perform a commit if the merge succeeds (default) --edit edit message before committing --ff allow fast-forward --ff-only abort if fast-forward is not possible --verify-signatures verify that the named commit has a valid GPG signature --autostash automatically stash/stash pop before and after rebase -s, --strategy <strategy> merge strategy to use -X, --strategy-option <option=value> option for selected merge strategy -S, --gpg-sign[=<key-id>] GPG sign commit --allow-unrelated-histories allow merging unrelated histories Options related to fetching --all fetch from all remotes -a, --append append to .git/FETCH_HEAD instead of overwriting --upload-pack <path> path to upload pack on remote end -f, --force force overwrite of local branch -t, --tags fetch all tags and associated objects -p, --prune prune remote-tracking branches no longer on remote --recurse-submodules[=<on-demand>] control recursive fetching of submodules -j, --jobs[=<n>] number of submodules pulled in parallel --dry-run dry run -k, --keep keep downloaded pack --depth <depth> deepen history of shallow clone --unshallow convert to a complete repository --update-shallow accept refs that update .git/shallow --refmap <refmap> specify fetch refmap
如果源是origin,分支是master,我们必须添加一个可选项--allow-unrelated-histories,命令如下:
$ git pull origin master --allow-unrelated-histories
您可以选择一种方式赞助本站