Home  >  Q&A  >  body text

git - 本地仓库(里面已有文件)关联到远程库?

1.本地仓库已有文件

2.如何将关联的远程库中的内容 拉到本地仓库来

我知道的,如果先有远程库,可以用git clone
如果本地仓库是空的没有任何东西 可以用git pull将远程库的东西拉到本地仓库来

现在我有一个有文件的仓库与一个远程库关联,如何将远程库中的内容拉到本地来
我用git pull origin master:master 会得到如下的错误

某草草某草草2727 days ago727

reply all(6)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-02 09:46:15

    If there is a conflict, you can git fetch origin master,然后处理冲突文件,处理完后 add-commit-push this set first.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-02 09:46:15

    The two libraries do not have a common ancestral history and cannot be simply merged.
    You need to think about which library you want to extract the submission records from and apply them to another library.

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-02 09:46:15

    My suggestion is to clone the remote warehouse first, and then copy the local warehouse directly into it. Although this method is not very elegant, it can still solve the problem well. In addition, it is best not to add any files when initializing the remote warehouse, as this will make subsequent work more difficult.

    reply
    0
  • 为情所困

    为情所困2017-05-02 09:46:15

    Firstgit fetchgit pull will automatically merge, fetch will not, then resolve the code conflict and then merge

    reply
    0
  • 为情所困

    为情所困2017-05-02 09:46:15

    First pull an empty folder, then replace your existing files in push

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-02 09:46:15

    You can submit local code first and then use git pull origin master, resolve conflicts and then git commit and then git push origin push

    reply
    0
  • Cancelreply