Using Xargs to delete git history
Needed to delete the .git history out of a folder and subfolders and thought xargs would do what I needed to do.
First find all the relevant files using find
find . -type d -name ".git"
: Find all the.git
foldersfind . -name ".gitignore"
: Find all the.gitignore
filesfind . -name ".gitmodules"
: Find all the.gitmodules
files for submodules (there were none, but just in case)
Delete the files and or folders passed in xargs rm -rf
Logically find everything and then delete it all
( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" ) | xargs rm -rf