Git has --force
flag in a lot of operations but when I use them I feel a bit strange. Like ignoring warning messages in my code.
For example I just wanted to unstage a file and did this:
git rm --cached myfile.ext
git complained error:
the following file has staged content different from both the file and the HEAD
I really don't care about this error and it seems not to be an issue - I just want to leave my code as it is, but unstage the file. --force
flag simply solved this issue.
My question is about best practices as I was unable to find any information about this issue - should one use force flags in git commands or is it a bad practice?
UPDATE
I have found this question of mine and had some insight that my be useful to anyone interested.
force
flag is like kinda yes/no
dialog in git(or any similar software). Like when doing something that might fail or damage something usually we get yes/no
dialog. So git
equivalent of yes
is --force
which answers my question that force
flag usage is just a normal routine.