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

Re: protect .git folder/files from grep/sed commands

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Mar 16, 2019, 01:51 UTC
Message-ID
<20190316015115.GB24175@szeder.dev>
In-Reply-To
<SYXPR01MB09574FEB4E6D6476B4F1D155DD450@SYXPR01MB0957.ausprd01.prod.outlook.com>
On Sat, Mar 16, 2019 at 01:37:39AM +0000, Dimitri Joukoff wrote:
Show 7 quoted lines
> When performing global changes in a project/tree using a command like:
> 
> grep -r "search" | xargs -I {} sed -i '' s/search/replace/g
> 
> there exists the possibility that this command will alter data in .git
> folder.  Using GNU grep, it is possible to use --exclude '/.*"' to avoid
> the .git folder, but this flag is not available on BSD grep (i.e. MacOS).
Try 'git grep "search" | ...'
Previous: Dimitri Joukoff
Message 2 of 2 in “protect .git folder/files from grep/sed commands”
  1. Dimitri JoukoffMar 16, 2019
  2. SZEDER GáborMar 16, 2019

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.