From: Johannes Sixt <j.sixt@viscovery.net>
To: Marcel Cary <marcel@earth.care2.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: checkout/update boiler plate for --filter-index?
Date: Tue, 24 Mar 2009 08:21:06 +0100 [thread overview]
Message-ID: <49C889E2.2080208@viscovery.net> (raw)
In-Reply-To: <580660BE-FDAB-4947-B409-1E8D5CBEF8EE@earth.care2.com>
Marcel Cary schrieb:
> I'm trying to do a historical find-and-replace on my code:
>
> git grep -F foo > files
> git filter-branch --index-filter "
> cat `pwd`/files | xargs git checkout --
> cat `pwd`/files | xargs sed -i 's/foo/bar/g; '
> cat `pwd`/files | xargs git update-index --
> " ancestor..HEAD
>
> When I instead use --tree-filter and skip the checkout/update-index, it
> works how I want (but it takes a while...). But when I use
> --index-filter, the resulting history shows the "foo" to "bar" change
> happening *after* new code is added, rather than originally adding "bar".
>
> How can I checkout just a few files and update them to take advantage of
> the speed of index operations?
You cannot do that with the index filter because you need actual blob
contents to operate on, but the index filter doesn't give you an
opportunity to do that. The tree filter is the right filter to use. But
you neither need 'git checkout' nor 'git update-index' in the filter -
filter-branch calls them for you. (Oh, and get rid of that useless use of
cat.)
-- Hannes
next prev parent reply other threads:[~2009-03-24 7:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-23 21:33 checkout/update boiler plate for --filter-index? Marcel Cary
2009-03-24 7:21 ` Johannes Sixt [this message]
2009-03-24 7:43 ` Jeff King
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=49C889E2.2080208@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=marcel@earth.care2.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).