git pull subtree deletes everything
I’m trying to take advantage of the subtree feature in git where I can have a repo that reference an other repo and thus appears to have all the files of both repos. I have read a couple of intros here and here and have tried to follow them.
So I have two repos in git hub. I do this
git checkout testBranchA git pull origin testBranchA git remote add external email@example.com:reharik/repoB git fetch external git checkout -b external external/testBranchB git read-tree --prefix=src/ -u external git commit -m "added subtree"
so now I look at my file sys and I see all the files from both repos and everything is great. Then I do
git pull -s subtree external testBranchB
and it seems that everything in both local repos is deleted. infact first it does
on all files, then it seems to do a merge where you see all the files with red and green +’s and -‘s, then it does
delete mode 100644 src/...
for all files
So i’m not sure what I’m doing wrong but clearly it’s something.
Any help would be appreciated
=== edit sorry to keep changing the commands, I’m a bit fried at this point but I think this is the syntax I’m using
One Solution collect form web for “git pull subtree deletes everything”
git pull -s subtree ... command does not seem right, since it is not taking into consideration the location of the subtree. As it is it will try to smash together both trees at the root level, which could be the cause of the files being deleted.
git pull -s recursive -X subtree=src/ external testBranchB