Apply gradle file from different repository

In that case, you could add a git subtree Merging (different to git subtree) to each of your repo, referring to the infra repo.

git read-tree --prefix=<subdirectory_name>/ –u <shared_library_branch>

You can see a study doing that in “Managing Nested Libraries Using the GIT Subtree Merge Workflow“.

http://www.typecastexception.com/image.axd?picture=Subtree%20Illustration_thumb_1.png

In your case:

cd /path/to/project
git remote add infrarepo /url/to/infra/repo
git fetch infrarepo
git checkout -b infra infrarepo/master

git checkout master
git read-tree --prefix=infra/ –u infra
git commit -m "Add Infra subtree"

To update the project repo with subtree changes:

git checkout infra
git pull
git checkout master
git merge --squash –s subtree –-no-commit infra
git commit -m "update infra"

To update the subtree repo with change from the subtree folder of the project repo:

git checkout infra
git merge --squash –s subtree --no-commit master
git commit -m "(infra subtree) nature of changes"

git push infrarepo infra

Leave a Comment