Cómo quitar todos los directorios .git
en una carpeta en Linux.
Este comando encontrará una lista de todos .git
directorios bajo la carpeta actual:
find . -type d -name ".git" \
&& find . -name ".gitignore" \
&& find . -name ".gitmodules"
Prints:
./.git
./.gitmodules
./foobar/.git
./footbar2/.git
./footbar2/.gitignore
Sólo debe haber como 3 o 4 .git
directorios porque git sólo tiene una. carpeta git para cada proyecto. Puedes hacer esos a mano.
Si usted se siente como la eliminación de todos en un solo mando y vivir peligrosamente:
//Retrieve all the files named ".git" and pump them into 'rm -rf'
//WARNING if you don't understand why/how this command works, DO NOT run it!
(find . -type d -name ".git" \
&& find . -name ".gitignore" \
&& find . -name ".gitmodules") | xargs rm -rf
//WARNING, if you accidentally pipe a `.` or `/` to xargs rm -rf,
//then everything will be gone. Which requires an OS reinstall.
Puede escribir un pequeño script para hacer esto, pero eso sería específico del sistema operativo. – Matten