So I have multiple repositories and a central repository.
Whenever there is a commit on any of the "multiple repositories" I need that commit to go to the central repository.
Can this be achieved?
@Mikael Sandberg I'm not sure if this solves my problem. If I use sobmodules, in order to get any changes in the submodules I have to update the central repo.
I want any changes to submodules to automatically commit to the central repo without me having to update. The whole purpose is that when submodule repo has a commit that commit comes to central one and that commit will trigger my pipeline from the central repo
You can use Git hooks to automate the update of your central repository. The only downside is that you have to install the hook on each client. Have a look at these two blog post on how to distribute hooks:
Git will not allow you to push a repository to another repository unless the stem from the same "master" repository. That would cause an out-of-sync in Git's internal storage. So you only option is to use either submodules or subtrees.
If you use submodules all changes are done in that submodule repository and once done you cd up to the parent repository and update the submodule pointer. The second part you should be able to automate with a hook.
If you use subtrees the process is a bit different. There you should be able to run the hook in Bitbucket so that you do not have to distribute your hook out to every client. If you go with subtree, then all changes should be done in each subtree repository, just like submodules, and then in the post receive hook on Bitbucket your hook would go into the central repository and run a git subtree pull.
I have only used git subtrees, because we decided to have a copy of the child repository in the central repository would be the simplest way of working. I would recommend reading the blog post I linked to above, it has detailed instructions on how to use git submodules. I would also check out this tutorial, Git subtree, and then decide what works best for your environment.
Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster ! While we’re all excited about the new improvements to Bitbucket ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events