Reputation: 1680
I have a Repo called "MVP" which contains code that I want to split out since it will be common to other parts of the system. I created a new Repo called "shared" with no history, I used Git Archive see here
I then git remote add mvp and git remote add shared in the same directory.
I pull the mvp and was hoping I could simply pull the shared too, however, git wants to do a merge. Which is not what I want.
Can anyone suggest a strategy that might work for my requirement to have a repo containing a shared code base and be able to pull that code base in-place within another local repo ?
EDIT:
Not sure if this is the best approach:
1. Create shared code repo
2. Create other repos for projects
3. Deploy projects (git pull)
4. Depoly shared repo (git pull)
5. Create Symbolic link from projects to shared repo
6. add symbolic link to .gitignore
Upvotes: 0
Views: 49
Reputation: 24291
A git pull is a git fetch followed by a git merge, so you actually asked git to do a merge.
I suspect that you however want to use a submodule or subtree for your usecase. That will allow you to have a git repo inside an other git repo. You should read about this in the git book.
For your case I should try something like:
git clone ssh://example.com/mvp
git submodule add ssh://example.com/shared shared
git submodule update
Upvotes: 1