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

bob ebenze@hotmail.com July 31, 2013

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

2 votes
Ken Failbus July 31, 2013

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.

0 votes
cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2013

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
TAGS
AUG Leaders

Atlassian Community Events