Re: How to remove a git subtree and its history?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 22, 2011 at 6:19 AM, Robert Pollak <robert.pollak@xxxxxx> 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.  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.

> (Be free to CC git@xxxxxxxxxxxxxxx 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 :)

Have fun,

Avery
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]