Reputation: 4815
We have a bunch of team projects in our organization.
My goal is to have one core team project, let's call it $/Core
, containing a $/Core/Scripts
folder under which all our common build/deployment/etc.. scripts would live:
$/Core
└───Scripts
├───build
│ build_functions.ps1
│ build_tasks.ps1
│ run_build.ps1
│
└───deploy
deploy_functions.ps1
deploy_functions_configuration.ps1
deploy_functions_eventlog.ps1
deploy_functions_web.ps1
I want to have a way to "share" this common trunk into each one of our individual team projects:
$/Foo
└───Scripts
$/Bar
└───Scripts
$/WallaWalla
└───Scripts
$/Cucamonga
└───Scripts
I was thinking of essentially implementing this via branching. These are our premises:
$/Core/Scripts
trunk will always have priority over all the branches.$/Core/Scripts
location, and merge into all branches.Source Control Explorer gives me two options:
This would allow me to select a target:
But I also see this option available. I can select the one of the desired target folders, make it a branch.
At the end of which my target $/Target/Scripts
folder looks like this:
Upvotes: 2
Views: 145
Reputation: 22235
I would recommend not using branching at all in this scenario.
Keep the Core\Scripts folder as the place where you do development on the shared scripts. Then simply copy the scripts folder into each Project that needs to use it. Since you are only making changes to the scripts in the one place (Core), there is no need for branching/merging capabilities, a simple copy will do fine. When you want to pull the latest version of the Scripts into a Project, simply re-copy the Scripts folder.
Branching into each Project would accomplish the same thing but there is a big downside to that (and no significant benefits over a simple copy). You can't have a branch within a branch. And I'm assuming at some point you may want to have multiple branches in Project Foo (e.g. MAIN, DEV, HOTFIX, etc). If Project Foo has Scripts as a branch within it, it severely limits your branching options for Foo.
Upvotes: 3