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?

4
  • 1
    One way is to simply stop using git subtree commands. What aspects would you like to "erase" ? Commented Nov 13, 2021 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. Commented Nov 14, 2021 at 1: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. Commented Nov 14, 2021 at 13:58
  • Like this: stackoverflow.com/a/18339297/7976758 ? (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: stackoverflow.com/a/60401536/7976758 Commented Nov 14, 2021 at 14:55

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.