An attempt to delete all files from the repository ends with an error:

$ git rm -r * 

error: the following files have been changed in the index:

How to understand this error? What should I do to remove?

  • one
    Apparently you have uncommitted files. Show git status output. - KoVadim
  • Changes to be committed: Green color 12 files. - Maks.Burkov
  • one
    You need to log in, because at the moment there is no information about your account. for example, like this: git config --global user.email "you@example.com" - lexxl
  • one
    Not to "log in", but rather to set the basic settings of the gita. Follow the instructions on this page: githowto.com/en/setup?_=1452811688537 - Nick Volynkin
  • one
    In general, I recommend going through at least the first couple of chapters of a textbook before doing something like deleting all the files. - Nick Volynkin

1 answer 1

Pre-notification : I don’t consider the question of the meaningfulness of the action itself to delete all files from the repository: what if it really does.


The full text of the message is:

error: the following file has been changed in the index:
list of files
(use --cached to keep the file, or -f to force removal)

if your task is to really delete files, then use the second hint by adding the -f option

 $ git rm -rf * 

after this, of course, it will be necessary to fix these changes in the repository using the commit command:

 $ git commit 

there is a similar error due to the fact that with the help of the add command you added some changes to the index (a new file or changes already being monitored), but did not fix them with commit .