3 ms·
Git can already do that with subtree, no other tools needed.
by minxomat 7y ago
Git can already do that with subtree, no other tools needed.
- jD91mZM2 7y ago(Note that subtree is a user-contributed script, but it's been made to ship with most git installations)
- oefrha 7y agogit-subtree is for incorporating an entire repo. To cherry-pick a single directory from another repo you probably need git-filter-branch to split that out into a standalone repo first, followed by git-subtree. Still, this is just two commands so I don’t see why a third party tool is warranted, especially since the third-party tool here seems to require a more complicated process (maybe it achieves more than what I think it achieves, I just don’t see it from the description, especially considering the problem it set out to solve seems to be exactly what I had in mind).
- AlotOfReading 7y agoFilter-branch / subtree doesn't let you move files outside the subdirectory, as far as I'm aware. Happy to be corrected on this point though.
- js2 7y agoThere's basically nothing you can't do with filter-branch and the variety of filters it can execute. Moving a subdirectory to the root is trivial with --subdirectory-filter, but even without that, you could do it with --index-filter or --tree-filter.
- sidpatil 7y agoI'm still not too familiar with the differences between subtree and submodule. When should I use either?
- mattsanders 7y agosubtree is more transparent to users of the repo as it is basically pulling in a copy of the repository during the clone. submodules on the other hand are only storing the metadata pointer to the child repo and require users to manually clone. I have more information regarding subtree (and subtree merge strategy) on this answer: https://stackoverflow.com/a/33579069/2105636 https://stackoverflow.com/a/33579069/2105636
- chrisseaton 7y agoHow can I use subtree to move a file into a repo preserving history?