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?

Thanks,

Eric

2 answers

Eric,

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:

https://jira.atlassian.com/browse/STASH-2714

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?

Charles

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,768 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