0

I'm trying to find out if it's possible to share the same repository between two projects with Git/SourceTree.

I have a two sites with their own repos, both have a plugins folder. Currently, any changes I apply to one plugin, i have to do the same to the plugin on the other site.

I've now created a 3rd repo just for my plugins (i.e. plugFolder1/2/3), I've not included file1.asp, file2.asp, .gitIgnore as they are unique to the site.

Is it possible to share my plugins repo and pull its content to siteA/B plugins folders. That way I can make changes to my plugins in their receptive site and commit the changes back to the plugins repo for the other sites to pull.

I've looked into submodule and subtree, when I try to add them via SourceTree, I don't understand how I'm able to pull the content from my plugins repo into my site plugins folder.

I have never used any complex stuff within GIT and I don't want to do it wrong.

Current setup

**SiteA**
index.asp
someOtherFile.asp
 > plugins
    .gitIgnore
    file1.asp
    file2.asp
    plugFolder1
    plugFolder2
    plugFolder3

**SiteB**
index.asp
someOtherBFile.asp
 > plugins
    .gitIgnore
    file1.asp
    file2.asp
    plugFolder1
    plugFolder2
    plugFolder3

Expected setup

Expected setup

Community
  • 1
  • 1
david-l
  • 623
  • 1
  • 9
  • 20
  • You could create some rules for developers, something like this: _create a folder for the site, than put inside it two parallel folders - plugins and code. Inside plugins, clone repo "plugins", inside code, clone the repo for your project._ – Leonardo Alves Machado Jul 25 '17 at 12:56
  • That won't be possible as the structure has to remain as described above. – david-l Jul 25 '17 at 15:51
  • Does anyone have any thought on this? – david-l Jul 27 '17 at 11:36

1 Answers1

0

You could clone your site* repository and put the plugins folder on the .gitignore file from the root of site*. Something like this:

SiteA
  .gitignore
  plugFolder1/
    #cloned content for plugin repo
  plugFolder2/
    #cloned content for plugin repo
  plugFolder3/
    #cloned content for plugin repo
  file1
  file2...

On git ignore file (root of SiteA)

plugFolder1/
plugFolder2/
plugFolder3/
#Binaries, editor cache, etc...
Leonardo Alves Machado
  • 2,747
  • 10
  • 38
  • 53
  • I've edited my original question and added an image illustrating what I'm hoping is possible with use of SourceTree. – david-l Jul 28 '17 at 12:54
  • I've attempted what you suggested, at least from what I understand but it didn't work. in my SiteA via shell, i did the following but it didn't work; git clone https://sitePluginsRepo.com/ temp mv temp/.git plugins/.git rm -rf temp – david-l Jul 28 '17 at 12:57
  • Does anyone have an idea how I can approach the issue i'm having, am I asking for something that can't be achieved? – david-l Sep 06 '17 at 10:29