Best practice to use an Internal Clone of another Git Repo?

I've have a local version of Stash running and all the local developers have access to it. For internal projects, everything is fine.

I am having trouble working on a client's project however. I need to be able to clone his git repo, push it into Stash so that we can all work on it, and once we are done making our internal changes, push a final change back to the client. For all intents and purposes, the client will not be getting all the day-to-day commits, only the final product.

What is the best way to accomplish this? If I clone the repo in my Git client (ex: Sourcetree) and push it to Stash, how do I ensure that the Stash version remains up-to-date with the client's? ie: if the client adds new functionality to their code base, we would like to have it as well. Is my only choice to periodically pull changes from the client in Sourcetree, and then push them to Stash?

Is there any automated way of doing something like this?



2 answers


I think the best way is to use git's merge capability. Create a client branch, merge changes from their stash repo to your local branch. Then merge from your local branch to your master and then push to your company's remote repo stash.

I haven't seen anything like that in stash syncing 2 remotes. But I am still not an expert in stash to know if there could be a way.

Hi Eric,

At the moment you basically need to keep doing a fetch and push. If you want to automate the process you can absolutely create a Bamboo/Jenkins/TeamCity plan that does a fetch of the client repository, merges with your own version and pushes to Stash. Note that this may quite possibly fail because if you and the client are both making changes you will eventually run into merge conflicts. At that point you would want the job to fail and someone to be notified so they can resolve manually (this can't be avoided).

You may also be interested in the following feature request:

Note that at the end of the day, if there's a merge conflict there's nothing Stash would be able to do except email the repository owner and ask them to fetch locally and resolve the merge.

Does that help?


Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

24,153 views 26 12
Join discussion

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