git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yi, EungJun" <semtlenori@gmail.com>
To: git@vger.kernel.org
Subject: Remove all files except a few files, using filter-branch
Date: Mon, 17 Sep 2012 01:28:31 +0900	[thread overview]
Message-ID: <CAFT+Tg_ipyPgNQxx8XsXySzmA3YM3mKe1gB5GyTNqN++gdphnQ@mail.gmail.com> (raw)

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' ' ')"

But this does not work well if there is a file whose name is not
encoded in us-ascii or includes parenthesis. git-filter-branch is
great to remove some files in my repository, but not good enough to
remove all except only a few.

Does anyone know the better way?

             reply	other threads:[~2012-09-16 16:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-16 16:28 Yi, EungJun [this message]
2012-09-16 17:06 ` Remove all files except a few files, using filter-branch Andreas Schwab
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=CAFT+Tg_ipyPgNQxx8XsXySzmA3YM3mKe1gB5GyTNqN++gdphnQ@mail.gmail.com \
    --to=semtlenori@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).