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

protect .git folder/files from grep/sed commands

From
DJDimitri Joukoff <dimitri.joukoff@griffithuni.edu.au>
Date
Mar 16, 2019, 01:37 UTC
Message-ID
<SYXPR01MB09574FEB4E6D6476B4F1D155DD450@SYXPR01MB0957.ausprd01.prod.outlook.com>
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).

Maybe git and the .git folder within a repository should be configured to use a separate user account, and then the .git folder would have its permissions set to 600?

Next: SZEDER Gábor
Message 1 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.