git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Git subtree command sustainability
@ 2021-11-23 15:10 Loic Fouray
  2021-11-23 19:36 ` Elijah Newren
  0 siblings, 1 reply; 2+ messages in thread
From: Loic Fouray @ 2021-11-23 15:10 UTC (permalink / raw)
  To: git

Hi,

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 !
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)? 

Thanks for your help
Loïc

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Git subtree command sustainability
  2021-11-23 15:10 Git subtree command sustainability Loic Fouray
@ 2021-11-23 19:36 ` Elijah Newren
  0 siblings, 0 replies; 2+ messages in thread
From: Elijah Newren @ 2021-11-23 19:36 UTC (permalink / raw)
  To: Loic Fouray; +Cc: Git Mailing List

On Tue, Nov 23, 2021 at 11:13 AM Loic Fouray <loic@yeplaa.net> wrote:
>
> Hi,
>
> 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 !
> 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)?
>
> Thanks for your help
> Loïc

Extracting a directory and its commits is a fairly simple kind of
rewrite.  If that's all you need, both tools can do it.  If
git-subtree works for you, that's great, and you don't need to switch
to a different tool.

If you're trying to do something a bit more complex, here are reasons
you might want to use one tool or the other:

- When rewriting history, commit IDs change.  git filter-repo will
rewrite commit messages to update references to (possibly abbreviated)
commit IDs to use the new commit IDs.  As far as I know, it's the only
history rewriting tool that does that; so if that's important to you,
using filter-repo may be beneficial.  But not all projects are
concerned with this; some repositories just don't have commit messages
that reference other commits.

- git-filter-repo allows much more complex rewrites (e.g. replacing
text in files while you are at it, stripping large blobs, using
mailmap to permanently change names, generic path manipulation,
inserting a commit, etc.), so if you also need to make other changes,
filter-repo is the tool you want.  git-subtree offers no other kind of
rewrite.

- git-filter-repo makes no effort to allow simultaneously working with
both the original and rewritten histories.  That kind of thing does
not mesh well with a generic history rewriting tool; you have to have
very specific types of rewrites to allow history to be reversible so
you can take information back to the original repo (in addition to
needing to track extra metadata).  However, git-subtree was written
precisely with a limited history rewrite in mind where this is
possible and provides tooling to assist you in working with both
histories and porting changes between the two.  If that's something
you want to do, git-subtree is the better tool for you.

- If you run into a scale where git-subtree doesn't work, but you do
want the simultaneous working with old-and-new histories abilities,
you may want to look into https://github.com/josh-project/josh.


Hope that helps,
Elijah

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-23 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 15:10 Git subtree command sustainability Loic Fouray
2021-11-23 19:36 ` Elijah Newren

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).