Re: Move some files, with all history, from one project into a new one

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

 



On Wed, Apr 15, 2020 at 08:31:35AM +0000, Kerry, Richard wrote:

> I would like to move some files, from the project in which they have
> always resided into  a new project.  I would like to keep all their
> history.  I don't want to waste space by also moving the rest of the
> old project's history, or historical file contents.

Try git-filter-branch's --subdirectory repository, which is designed to
do exactly this.

Or the much newer (and faster) git-filter-repo:

  https://github.com/newren/git-filter-repo

> Do I create a new branch, then delete the rest of main-system leaving
> only what I want?  Surely if I do that then I would end up with all
> the main-system file data within the new repo, which would expand its
> size.  Is there a recommended way to extract certain files with their
> histories?

Correct; just deleting files and creating a new commit will still carry
them in the history. You have to rewrite the old commits.

-Peff



[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]

  Powered by Linux