{"thread":{"id":"56967","subject":"Git subtree command sustainability","startedAt":"2021-11-23T15:10:13Z","lastAt":"2021-11-23T19:37:13Z","messageCount":2,"participants":["Loic Fouray","Elijah Newren"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"442156","messageId":"5D6F04AA-1CE6-423D-B097-58C0F429C9CA@yeplaa.net","threadId":"56967","inReplyTo":null,"subject":"Git subtree command sustainability","fromName":"Loic Fouray","fromEmail":"loic@yeplaa.net","sentAt":"2021-11-23T15:10:07Z","receivedAt":"2021-11-23T15:10:13Z","isPatch":false,"sender":{"key":"loic@yeplaa.net","avatar":null},"body":"Hi,\n\nI want use the git subtree split command on a new repo for splitting, extracting only a directory with its commits related from an upstream repo. It works !\nBut I would like to know if the subtree split command is sustainable or if you advise to use other tools (as git-filter-repo for exemple)? \n\nThanks for your help\nLoïc"},{"id":"442192","messageId":"CABPp-BF8_E+=8+5UnztM4wYML__E4uC=z5nPVAd+AYVH59Bvqg@mail.gmail.com","threadId":"56967","inReplyTo":"5D6F04AA-1CE6-423D-B097-58C0F429C9CA@yeplaa.net","subject":"Re: Git subtree command sustainability","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2021-11-23T19:36:59Z","receivedAt":"2021-11-23T19:37:13Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, Nov 23, 2021 at 11:13 AM Loic Fouray <loic@yeplaa.net> wrote:\n>\n> Hi,\n>\n> I want use the git subtree split command on a new repo for splitting, extracting only a directory with its commits related from an upstream repo. It works !\n> But I would like to know if the subtree split command is sustainable or if you advise to use other tools (as git-filter-repo for exemple)?\n>\n> Thanks for your help\n> Loïc\n\nExtracting a directory and its commits is a fairly simple kind of\nrewrite.  If that's all you need, both tools can do it.  If\ngit-subtree works for you, that's great, and you don't need to switch\nto a different tool.\n\nIf you're trying to do something a bit more complex, here are reasons\nyou might want to use one tool or the other:\n\n- When rewriting history, commit IDs change.  git filter-repo will\nrewrite commit messages to update references to (possibly abbreviated)\ncommit IDs to use the new commit IDs.  As far as I know, it's the only\nhistory rewriting tool that does that; so if that's important to you,\nusing filter-repo may be beneficial.  But not all projects are\nconcerned with this; some repositories just don't have commit messages\nthat reference other commits.\n\n- git-filter-repo allows much more complex rewrites (e.g. replacing\ntext in files while you are at it, stripping large blobs, using\nmailmap to permanently change names, generic path manipulation,\ninserting a commit, etc.), so if you also need to make other changes,\nfilter-repo is the tool you want.  git-subtree offers no other kind of\nrewrite.\n\n- git-filter-repo makes no effort to allow simultaneously working with\nboth the original and rewritten histories.  That kind of thing does\nnot mesh well with a generic history rewriting tool; you have to have\nvery specific types of rewrites to allow history to be reversible so\nyou can take information back to the original repo (in addition to\nneeding to track extra metadata).  However, git-subtree was written\nprecisely with a limited history rewrite in mind where this is\npossible and provides tooling to assist you in working with both\nhistories and porting changes between the two.  If that's something\nyou want to do, git-subtree is the better tool for you.\n\n- If you run into a scale where git-subtree doesn't work, but you do\nwant the simultaneous working with old-and-new histories abilities,\nyou may want to look into https://github.com/josh-project/josh.\n\n\nHope that helps,\nElijah\n"}]}