What does the -f option mean for the git rm command? -
this question has answer here:
- when git rm -f used? 3 answers
i learning git through this online book. don't understand info git rm
command:
if modified file , added index already, must force removal
-f
option. safety feature prevent accidental removal of data hasn’t yet been recorded in a snapshot , can’t recovered git.
english not native language. have problems correctly translating of quote... "recorded in snapshot" mean? "commited"?
i see git rm 123.txt
the same git rm -f 123.txt
, if 123.txt changed , added index (i.e. storage area, through add
command): removes 123.txt index , working directory. so, don't understand -f
option meaning. please, expand me.
additional tried read this:
the files being removed have identical tip of branch, , no updates contents can staged in index, though default behavior can overridden
-f
option.
also this:
-f
--force
override up-to-date check.
what "tip of branch"? -f
option?
try make changes file in git repo , remove it. example:
$ git status # on branch master # branch up-to-date 'origin/master'. # nothing commit, working directory clean $ echo "a" >> http.c
and try remove it:
$ git rm http.c
you get:
git rm http.c error: following file has local modifications: http.c
so, -f/--force
option allow remove it:
$ git rm -f http.c rm 'http.c'
Comments
Post a Comment