Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Sharing the same repository between two projects

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. This structure cannot be changed.

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. Thank you in advance.


Current setup

 > plugins

 > plugins

Expected setup



1 answer

0 votes
minnsey Atlassian Team Jul 31, 2017


You are on the right track. Personally I would go with Submodules.

You should be able to add you plugins repository as a submodule to your two site repositories. I believe you have already done this.

Submodules store a reference to a particular commit, so they do not automatically update when you independently update the child, plugin , repository.

The way I tend to manage this is to

  • Open each site/parent repository in SourceTree
  • Open the plugin repository in SourceTree
  • Add the plugin/child repository to both parents as a submodule
  • Then add each submodule instance as a new bookmark in SourceTree, naming them in a way that allows you to identify them.

This means you can then work on the submodules semi-independently from the parent, e.g.

  • You can make changes on the canonical local instance of the plugin repository, commit them and push them to the host.
  • You can then open the two submodule instances and pull any changes from the host, this will update the commit reference for the submodule held by the site/parent repository.
  • Commit the submodule change in the site/parent repository.

Hope that makes sense.

Thank you so much for your assistance, it's the most information I've been able to get in the last few weeks. It’s in line with I was attempting to do but I doesn’t seem to work because the destination folder already exists in sitesA/B. 

When I create a submodule in siteA/B, I add the following
Soure path/URL: D:\webapps\testSites\sitePlugins
Local relative path: plugins

I get the following error 
git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=manager-st submodule add -f D:\webapps\testSites\sitePlugins plugins
'plugins' already exists in the index

As illustrated in my original message


The above repos each already have a folder called plugins and it contains files relevant to the site


Inside the sitePlugin repo I have;

I want to be able to pull the content from PluginRepo into


I hope you're able to advise me how to deal with this situation. 


 I'm sure, I'm not the only one who has come across this scenario before. Am I not explaining/understanding something properly?

Please help!

Is what I'm describing not possible? Can someone please help?

minnsey Atlassian Team Sep 11, 2017

Hi David,

Reading through your response I think the only aproach is to restructure your proects slightly.



With the following respective folders

But split your site plugins repo into 2, one each for pluginfolder1 and plugin folder2, as follows:


Then you should be able to add each as submodules into the \plugins folder of each site.

Effectively running the following on each site repo

git submodule add -f D:\webapps\testSites\sitePlugins\pluginFolder1 plugins\pluginFolder1

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Sourcetree

[dev team] Sourcetree for Windows 2019 Preview - Dark Theme

Hi folks, While the full post is over on our blog I'd like to share the dark theme we've got planned for 2019 here directly as well to keep the discussion going.  The ...

3,259 views 19 18
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you