1 year ago
#386523
JSAddict
Customize git subtree merge
I'm trying to merge a sub-repo into a main-repo in GIT.
my sub-repo file explorer
While doing the merge, I'm providing a specific folder for each of my sub-repo files & folders, for example my sub-repo/scripts folder to be moved under super-repo/test2-scripts. I'm able to do this using the git read-tree command. But the same cannot be done for files like readme.md, package.json and other such files. Is there any way to do this?
Here are the list of commands I executed in the super-repo.
git remote add -f test2 ssh://git@bitbucket.trimble.tools/twc/test2.git
git merge -s ours --no-commit --allow-unrelated-histories test2/master
git read-tree --prefix=src/test2-src/ -u test2/master:src
git read-tree --prefix=test2-config/ -u test2/master:config
git read-tree --prefix=test2-scripts/ -u test2/master:scripts
git read-tree --prefix=test2-public/ -u test2/master:public
my super-repo current file explorer
I also want to know how do I fetch and merge the latest changes from sub-repo to super-repo? It is possible if I just put the entire sub-repo under a single directory using
git pull -X subtree=src/test2/ test2 master
. But when I specify a separate folder for each sub-repo folder in super repo how do I mention those different folders in pull?
git
git-subtree
0 Answers
Your Answer