Git: dejar de seguir un fichero
Si nuestro repositorio Git está siguiendo el ‘fichero’ y queremos finalizar su seguimiento, podemos usar el comando git rm , ¡pero cuidado! porque esto borrará el fichero del disco. Siempre podríamos volver a alguna versión anterior del repositorio, pero también disponemos de la opción –cached (con dos guiones) para eliminarlo tan sólo del índice del repositorio.
$ git rm –cached fichero
rm ‘fichero’
$ ls fichero
fichero
$ git status
# On branch master
# Changes to be committed:
# (use “git reset HEAD …” to unstage)
#
# deleted: fichero
#
# Untracked files:
# (use “git add …” to include in what will be committed)
#
# backup/
# fichero
$ git commit -m ‘Untracking fichero’
[master d9557db] Untracking fichero
1 files changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 fichero
$
rm ‘fichero’
$ ls fichero
fichero
$ git status
# On branch master
# Changes to be committed:
# (use “git reset HEAD …” to unstage)
#
# deleted: fichero
#
# Untracked files:
# (use “git add …” to include in what will be committed)
#
# backup/
# fichero
$ git commit -m ‘Untracking fichero’
[master d9557db] Untracking fichero
1 files changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 fichero
$
Como se puede ver, el fichero permanece en disco, y tras aplicar el cambio es necesario hacer un commit.






