git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* protect .git folder/files from grep/sed commands
@ 2019-03-16  1:37 Dimitri Joukoff
  2019-03-16  1:51 ` SZEDER Gábor
  0 siblings, 1 reply; 2+ messages in thread
From: Dimitri Joukoff @ 2019-03-16  1:37 UTC (permalink / raw)
  To: git@vger.kernel.org

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?




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: protect .git folder/files from grep/sed commands
  2019-03-16  1:37 protect .git folder/files from grep/sed commands Dimitri Joukoff
@ 2019-03-16  1:51 ` SZEDER Gábor
  0 siblings, 0 replies; 2+ messages in thread
From: SZEDER Gábor @ 2019-03-16  1:51 UTC (permalink / raw)
  To: Dimitri Joukoff; +Cc: git@vger.kernel.org

On Sat, Mar 16, 2019 at 01:37:39AM +0000, Dimitri Joukoff wrote:
> 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" | ...'


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-16  1:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-16  1:37 protect .git folder/files from grep/sed commands Dimitri Joukoff
2019-03-16  1:51 ` SZEDER Gábor

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).