{"thread":{"id":"50752","subject":"protect .git folder/files from grep/sed commands","startedAt":"2019-03-16T01:38:27Z","lastAt":"2019-03-16T01:51:22Z","messageCount":2,"participants":["Dimitri Joukoff","SZEDER Gábor"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"371636","messageId":"SYXPR01MB09574FEB4E6D6476B4F1D155DD450@SYXPR01MB0957.ausprd01.prod.outlook.com","threadId":"50752","inReplyTo":null,"subject":"protect .git folder/files from grep/sed commands","fromName":"Dimitri Joukoff","fromEmail":"dimitri.joukoff@griffithuni.edu.au","sentAt":"2019-03-16T01:37:39Z","receivedAt":"2019-03-16T01:38:27Z","isPatch":false,"sender":{"key":"dimitri.joukoff@griffithuni.edu.au","avatar":null},"body":"When performing global changes in a project/tree using a command like:\n\ngrep -r \"search\" | xargs -I {} sed -i '' s/search/replace/g\n\nthere exists the possibility that this command will alter data in .git\nfolder.  Using GNU grep, it is possible to use --exclude '/.*\"' to avoid\nthe .git folder, but this flag is not available on BSD grep (i.e. MacOS).\n\nMaybe git and the .git folder within a repository should be configured\nto use a separate user account, and then the .git folder would have its\npermissions set to 600?\n\n\n\n"},{"id":"371641","messageId":"20190316015115.GB24175@szeder.dev","threadId":"50752","inReplyTo":"SYXPR01MB09574FEB4E6D6476B4F1D155DD450@SYXPR01MB0957.ausprd01.prod.outlook.com","subject":"Re: protect .git folder/files from grep/sed commands","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-03-16T01:51:15Z","receivedAt":"2019-03-16T01:51:22Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Sat, Mar 16, 2019 at 01:37:39AM +0000, Dimitri Joukoff wrote:\n> When performing global changes in a project/tree using a command like:\n> \n> grep -r \"search\" | xargs -I {} sed -i '' s/search/replace/g\n> \n> there exists the possibility that this command will alter data in .git\n> folder.  Using GNU grep, it is possible to use --exclude '/.*\"' to avoid\n> the .git folder, but this flag is not available on BSD grep (i.e. MacOS).\n\nTry 'git grep \"search\" | ...'\n\n"}]}