Shell: script para borrar todos los delete pendientes con GIT
Tengo la mala costumbre de borrar los ficheros desde mi editor de texto así que cuando vuelvo a consola y hago un ‘git status‘ me salen un montón de ficheros borrados y no encuentro el comando de ‘git‘ para decirle: cárgatelos todos en el próximo commit.
Así que me he hecho este script para decirle exactamente eso:
$ git rm `git status | grep "deleted" | cut -f 2 -d ":" | cut -d " " -f 5`
Cuidadín con él eh :).. a ver si no va a estar bien..
Actualización: como dice Juanma en los comentarios podemos hacerlo mucho más elegantemente con:
git add -u
Diciembre 28th, 2008 at 2:20 am
Prueba con
git add -u
Diciembre 28th, 2008 at 2:45 am
Genial @Juanma Gracias:
-u
Update only files that git already knows about, staging modified content for commit and marking deleted files for removal. This is similar to what “git commit -a” does in preparation for making a commit, except that the update is limited to paths specified on the command line. If no paths are specified, all tracked files in the current directory and its subdirectories are updated.