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?
Hi @mo.entezari,
Welcome to the Atlassian Community.
You could do this with Git Submodules, or Git Subtrees. See this blog post for more information about both options, Git Submodules vs Git Subtrees.
Thanks @Mikael Sandberg but the link does not take me anywhere.
Try now, I just updated the link.
@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:
https://www.darrenlester.com/blog/including-hooks-in-a-git-repository
https://www.viget.com/articles/two-ways-to-share-git-hooks-with-your-team/
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.
It looks like you're new here. Sign in or register to get started.