Search code examples
githubgit-remote

Anyone familiar with errors if I set two remotes on a git repository?


Scenario: A core repo having common code which can be used by other repos(say, client).

I have set core as a remote in client, so to get commits from core and client both in client repo I can do:

git pull core master
git pull origin master

I have tested this and it appears to be working fine in above scenario, any obvious error I might be missing?

Note: git-submodules cannot be used in my case


Solution

  • The only issue would be possible merge conflict when pulling, if you have common modified code between the two branches.

    The other issue would be to avoid pushing to the wrong remote (by default, a git push alone should push to origin, so you are OK)
    If you had to push back to code, that would be problematic, as you would possibly be pushing code for origin as well.