'Partial git synchronization between two unrelated repositories
Let's say I have a repository with a folder hierarchy like this one:
repo1
+- project1
+- project2
+- project3
+- project4
+- project5
+- ...
There is another repository repo2 which should contain only a subset of projects/folders from the repo1:
repo2
+- project1
+- project2
+- project4
I am looking for the most efficient/simple/reliable (pick any two) way to occasionally synchronize repo1 and repo2.
Conditions:
I specifically do not want to add
repo1as a remote repo forrepo2. Parts ofrepo1that are not supposed to be synchronized should not be accessible.The
repo2repository is essentially a snapshot repository. It will only be updated to include the recent changes fromrepo1. There will never be any direct, manual commits made to it.Synchronization does not need to happen on every commit in
repo1. In fact, the synchronization should only be triggered either explicitly or on somerepo1event that occurs less frequently (such as tagging).It is not necessary to synchronize all individual commits made in
repo1since last synchronization. When synchronizing, it will be enough to just take the current versions of relevantrepo1projects and push them torepo2.
I guess I'm looking for a less cumbersome version of this approach (ideally not having to do anything locally):
- checkout
repo1locally - checkout
repo2locally - copy relevant projects/folders from
repo1working directory torepo2working directory - commit changes in
repo2 - push local
repo2commits to its origin
Any ideas/suggestions?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
