I currently have the following repository structure
Repository A
- Folder 1
- Folder 2
I need to take out the Folder 1 and create another repository like the following
Repository B
- Folder 1
But there will be active development on both A and B's folder 1 for the time being until such a time where we do a cutoff. So the need is to be able to keep them in sync such that whenever a PR is merged into the develop branch of Repository A, the same changes can be merged to Repository B if they belong to Folder 1.
My git knowledge is limited so my first question is this a feasible task and if so how to go about setting up Repository B and the corresponding merge mechanism. I have seen an example of splitting a subdirectory into a repo here - https://docs.github.com/en/github/using-git/splitting-a-subfolder-out-into-a-new-repository
But how do I keep them both in sync once they are created. Thanks for all your help.
An easy way to handle this is to continue to work in the current repo with Folder 1 & 2. When you are ready, simply delete Folder 2 from the main repo.
Otherwise:
Step 1: Create new repo from another repo's subfolder
Step 2: Keep new repo in sync with old repo.
It appears that the syncing of two repos can be accomplished with GitHub Actions.
If you have GitHub actions available to you, check out the github-sync repository which demos how to sync branches between repos.
It's unclear if GitHub actions will be able to differentiate changes to Folder 1 specifically. You may need to keep Folder 2 in the second/new repo until you are done with it.