Problem: If there is already a repository rePO1 locally, there is a project proj1 on master. There is a repository, RePO2, on the remote side, with a project Proj2 on master. Now I want to associate two warehouses, how to deal with?

Answer:

  1. The local master overwrites the remote master. Use git push -f to force an override or remove the remote master first and then push.
  2. The remote master overwrites the local master. Clone remote to local or delete the local master and then checkout the remote master to local.
  3. Both local and remote masters are retained. Just make the master branch name of the two repositories different. For example, if the master of rePO1 is named master1 and the master of repo2 is named master2, the two libraries are associated successfully, and master1 plays proj1 and master2 plays proj2. Proj1 and proj2 have no relationship. How do you name it? Take repo1 as an example. Create a branch master1 from master and then delete master.

Application:

  • Build a blog with Hexo using only one Git repository. Set up two branches, one for the source code and the other for the generated site.
  • From this third point we can derive the use of a git repository to manage multiple different projects