0

I have a file named -fL that generated by curl command in my project, now I added the -fL file to .gitignore, then I want to remove it from the git repository. I have tried to use this command:

git rm "-fL"
git rm '-fL'
git rm -fL

both of this command could not remove the file successfully, what should I to do remove it? The error may look like this:

error: unknown switch `L'
usage: git rm [<options>] [--] <file>...

    -n, --dry-run         dry run
    -q, --quiet           do not list removed files
    --cached              only remove from the index
    -f, --force           override the up-to-date check
    -r                    allow recursive removal
    --ignore-unmatch      exit with a zero status even if nothing matched
    --sparse              allow updating entries outside of the sparse-checkout cone
    --pathspec-from-file <file>
                          read pathspec from file
    --pathspec-file-nul   with --pathspec-from-file, pathspec elements are separated with NUL character
spark
  • 663
  • 1
  • 5
  • 18
  • 1
    https://stackoverflow.com/questions/22750028/in-git-what-does-dash-dash-mean + `git rm -- -fL`. Note that `"` and `'` relate to how the shell interpreter interprets your commands and have nothing to do with git per se. – terrorrussia-keeps-killing May 14 '22 at 11:23
  • 3
    Write the path with the current directory as a prefix: `git rm ./-fL` this will work with *all* tools. – Andreas Louv May 14 '22 at 11:25

0 Answers0