git/list[1] front-page[2] threads[3] people[4] search[5] about
 

checkout/update boiler plate for --filter-index?

From
MCMarcel Cary <marcel@earth.care2.com>
Date
Mar 23, 2009, 21:33 UTC
Message-ID
<580660BE-FDAB-4947-B409-1E8D5CBEF8EE@earth.care2.com>
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?

Marcel
Next: Johannes Sixt
Message 1 of 3 in “checkout/update boiler plate for --filter-index?”
  1. Marcel CaryMar 23, 2009
  2. Johannes SixtMar 24, 2009
  3. Jeff KingMar 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.