3 ms·
And after I just spent several hours of headaches rebasing and wrangling git subtree and attempting to git rebase -i branch -s subtree --rebase-merges --allow-u
by jimbo1qaz 7y ago
And after I just spent several hours of headaches rebasing and wrangling git subtree and attempting to git rebase -i branch -s subtree --rebase-merges --allow-unrelated-histories (which doesn't work)...
Request: Is it possible to import only one subdirectory of another Git repository as a subtree (excluding unit tests and build scripts and such)?
- bryanlarsen 7y agoGit subrepo can import a subdirectory. To oversimplify, it's a wrapper for git subtree that keeps metadata information in both your filesystem and your history so that things stay sane. https://github.com/ingydotnet/git-subrepo https://github.com/ingydotnet/git-subrepo
- jimbo1qaz 7y agoDoes subrepo break when you rebase both a commit and its parent? I recall doing something like that in the past, and subrepo stopped working.
- bryanlarsen 7y agoVersion 0.4.0 of subrepo has been rock solid for us and has handled everything that's been thrown at it; prior versions wouldn't handle odd situations well. Whether our "odd situations" line up with yours is a different question... Edit: to be clear; even before 0.4.0 git subrepo handled strange situations better than git subtree did mostly because git subtree requires so much more manual work that's easy to get wrong.
- oefrha 7y agoUse git-filter-branch with --subdirectory-filter to create a new repo (with history preserved) followed by git-subtree.
- evmar 7y agoThe 'git-subtree' tool (by the same author as this tool) can import subdirectories.
- apenwarr 7y agoMore precisely, git-subtree can extract subdirectories into their own repo, and merge repos into subdirectories. What someone might want to try is extracting a subdirectory using git-subtree, and then importing it elsewhere using git-subtrac.