From: Andreas Schwab <schwab@linux-m68k.org>
To: semtlenori@gmail.com
Cc: git@vger.kernel.org
Subject: Re: Remove all files except a few files, using filter-branch
Date: Sun, 16 Sep 2012 19:06:59 +0200 [thread overview]
Message-ID: <m24nmxkibw.fsf@igel.home> (raw)
In-Reply-To: <CAFT+Tg_ipyPgNQxx8XsXySzmA3YM3mKe1gB5GyTNqN++gdphnQ@mail.gmail.com> (EungJun Yi's message of "Mon, 17 Sep 2012 01:28:31 +0900")
"Yi, EungJun" <semtlenori@gmail.com> writes:
> Hi, all.
>
> I want to remove all files except a few files, in the history of my
> git repository.
>
> I tried to do that as follows:
>
> git filter-branch --index-filter "git rm --cached --ignore-unmatch
> $(git ls-files | grep -v '^filename$' | tr '\n' ' ')"
Try instead first removing all files, then restoring the files you want
to keep.
--index-filter "git rm --cached -qr -- . && git reset -q -- filename"
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2012-09-16 17:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-16 16:28 Remove all files except a few files, using filter-branch Yi, EungJun
2012-09-16 17:06 ` Andreas Schwab [this message]
2012-09-18 15:01 ` Yi, EungJun
2012-09-18 15:10 ` Johannes Sixt
2012-09-18 15:25 ` Yi, EungJun
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=m24nmxkibw.fsf@igel.home \
--to=schwab@linux-m68k.org \
--cc=git@vger.kernel.org \
--cc=semtlenori@gmail.com \
/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).