1

Parallel the same ask in Convert a git submodule to a regular directory and preserve the history in the main tree? but on git subtrees.

So I've added a git subtrees, it's content and history is now in my main tree, and now I want to turn such git subtrees to a complete plain regular directory, removing the git's knowledge that such directory belongs to a subtrees. How can I do that?

xpt
  • 20,363
  • 37
  • 127
  • 216
  • 1
    One way is to simply stop using `git subtree` commands. What aspects would you like to "erase" ? – LeGEC Nov 13 '21 at 22:17
  • I don't want to move subdirectory into separate Git repository @phd, I just want it to stay there. If I clone such containing-subtree repo, the cloned repo knows there is subtree there. That's what I like to erase, @ LeGEC. – xpt Nov 14 '21 at 01:52
  • I once saw an answer that can list all git subtrees that one repo has, but cannot find it anywhere now. So, basically, I'm asking how to list all git subtrees that one repo has, and how to remove one from such list. – xpt Nov 14 '21 at 13:58
  • Like this: https://stackoverflow.com/a/18339297/7976758 ? (https://stackoverflow.com/search?q=%5Bgit-subtree%5D+list+subtrees). AFAIU subtrees are marked in commit messages so to remove subtree you need to edit merge commit messages: https://stackoverflow.com/a/60401536/7976758 – phd Nov 14 '21 at 14:55

1 Answers1

2

Thanks to @phd and @LeGEC, I now believe the answer is exactly as @LeGEC said,

simply stop using git subtree commands

I thought there are traces in git repo when git subtree add was issued, but it turns out that,

I went through the code (basically all this mechanism is a big shell script file), all of the tracking is done through commit messages, so all the functions use git log mechanism with lots of grep-ing to locate it's own data.

So, no, there aren't any special marks / traces in git repo other than its commit messages, and I'm fine with that -- the git subtree has already become a complete plain regular directory, which was what I had been asking for. thanks.

xpt
  • 20,363
  • 37
  • 127
  • 216