Let's say I have two repos, repo A and repo B, which contains a folder with code similar to the code in repo A (doesn't really matter how this actually has happened, but OK, let's assume I've just copied contents from A).
Now I want following:
So, basically, I'm looking for the cheapest way to have something like reversed sparsed check out.
It seems exactly the kind of problem git-subtree1 tries to solve.
cd repoB
git subtree pull -P folder {repoA URL} {repoA branch}
... edit test commit...
git subtree push -P folder {repoA URL} {repoA branch}
You can add a ref for and so publish anything in a repo. So, to maintain a separate branch that tracks the main branch's subfolder, add this to your commit ritual:
# in your commit ritual (no need to be mainbranch-specific,
# this will detect changes and add the tracking commits only as necessary),
if [ `git rev-parse mainbranch:path/to/subfolder` \
!= `git rev-parse subfolderbranch:path/to/subfolder` ]; then
git commit-tree -p subfolderbranch -p mainbranch \
mainbranch:path/to/subfolder <<<"tracking mainbranch subfolder" \
| xargs git update-ref -m"tracking mainbranch subfolder" refs/heads/subfolderbranch
fi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With