git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Pollak <robert.pollak@jku.at>
To: Avery Pennarun <apenwarr@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: How to remove a git subtree and its history?
Date: Wed, 23 Mar 2011 10:01:40 +0100	[thread overview]
Message-ID: <4D89B6F4.2050209@jku.at> (raw)
In-Reply-To: <AANLkTiktAUeOkX0MZh+JbQb1z-JiN=Qet6_AuWavsNk=@mail.gmail.com>

Am 22.03.2011 21:44, schrieb Avery Pennarun:
> On Tue, Mar 22, 2011 at 6:19 AM, Robert Pollak <robert.pollak@jku.at> wrote:
>> in the git repository of my project I have successfully replaced a git
>> submodule by a subtree, essentially by using
>>
>> $git subtree add --prefix=mySubtree mySubmodule/master
>>
>> with your git-subtree.sh .
>>
>> Before accepting my change, my project partners want to be sure that
>> removing this new subtree and its history at some later point in time
>> stays possible. How can I achieve this? I have unsuccessfully tried "git
>> filter-branch" as described by pgs and fmarc in
>> http://stackoverflow.com/questions/955793#955793 .
> 
> Well, you can certainly remove anything you want with git
> filter-branch.  Are you concerned about shrinking the size of your
> repo, or just getting files out of the way in your tree, or removing
> stuff from the git history?
> 
> If you want to avoid cluttering the git history, you should use git
> subtree with the --squash option.  That makes it quite painless.
> 
> If you want to just get the files out of your tree someday in the
> future (for example, to switch back to submodules), then simply 'git
> rm -r' the directory.  Rewriting history is massive overkill for this.
> 
> If you want to be able to shrink your repository size later, well,
> then you need git filter-branch.

Yes, I am aware of the other options and that's what I want to do.
(I never really want to use this, I only need a test run to convince my
partners to switch to git-subtree.)

> I've never tried to do this since
> the history rewrite you'd be doing in this case would completely
> invalidate all your old history: by removing the subtree in all past
> revisions, you make all those past revisions unbuildable, which seems
> like missing the point of version control.  Nevertheless, I'm sure you
> could make it happen if you wanted; you can do pretty much anything
> you want by filtering git history.

I see. As quite a git newbie I hoped you had done this already and could
help me with the necessary git filter-branch command line.

>> (Be free to CC git@vger.kernel.org if you reply, if you think that's
>> appropriate for archiving the info.)
> 
> I don't understand why you didn't cc: the git list yourself then.  But okay :)

I was not sure whether discussion of git-subtree belongs there, since it
is not part of git (yet?).

> Have fun,

I certainly do!

Thank you,
Robert

  reply	other threads:[~2011-03-23  9:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4D88A1CB.2000500@jku.at>
2011-03-22 20:44 ` How to remove a git subtree and its history? Avery Pennarun
2011-03-23  9:01   ` Robert Pollak [this message]
2011-03-23 17:09     ` Avery Pennarun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D89B6F4.2050209@jku.at \
    --to=robert.pollak@jku.at \
    --cc=apenwarr@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).