What's the best way to manage projects that share code


I have two projects that share 90% of their codebase with eachother. What is the best way to manage them on stash so that when I make changes, the shared code is updated for both projects but the code that is unique to each one stays unique?


1 answer

1 vote
Colin Goudie Community Champion Nov 19, 2012

The 'correct' way is to modularise your code.

That way the shared code goes in it's own module and can be pulled in by whatever build system you use. e.g. Maven, you declare a dependency

However, if not possible, or impractical now, you could look at using something like git sub-modules.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,750 views 1 5
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you