From: Jeff King <peff@peff.net>
To: "Kerry, Richard" <richard.kerry@atos.net>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Move some files, with all history, from one project into a new one
Date: Wed, 15 Apr 2020 11:11:28 -0400 [thread overview]
Message-ID: <20200415151128.GA2464307@coredump.intra.peff.net> (raw)
In-Reply-To: <AM0PR02MB3715F9566BD9FEFAF832F0749CDB0@AM0PR02MB3715.eurprd02.prod.outlook.com>
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
next prev parent reply other threads:[~2020-04-15 15:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-15 8:31 Move some files, with all history, from one project into a new one Kerry, Richard
2020-04-15 15:11 ` Jeff King [this message]
2020-04-15 15:49 ` Taylor Blau
2020-04-16 6:05 ` Elijah Newren
2020-04-17 13:48 ` Kerry, Richard
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=20200415151128.GA2464307@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=richard.kerry@atos.net \
/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).