0

I have two repos git@remote:fruit.git and git@remote:veg.git and the Fruit repo contains a folder that does not belong there logically.

fruit
 |-.git
 |-apples
 |  |-royal_gala
 |-oranges
 |  |-tangerine
 |-beetroot
    |-sugar_beets

git-subtree seems to be the tool for the job, so I did the following:

git clone git@remote:fruit.git
git clone git@remote:veg.git

pushd fruit
git subtree split -P beetroot -b beetroot
popd

pushd veg
git subtree add -P beetroot ../fruit/ beetroot
git push
popd

pushd fruit
git rm -rf beetroot
git push
popd

This accomplished the task of moving the files but did not move the history. Is it possible to modify this procedure to move the history of beetroot changes or should I abandon git-subtree altogether?

Dima Chubarov
  • 16,199
  • 6
  • 40
  • 76
  • This seems to answer the question: use `pull` and `merge` instead of `subtree add`. https://stackoverflow.com/a/68536044/1328439 – Dima Chubarov Feb 17 '23 at 11:42

0 Answers0