2

I accidentially created and committed a file called --a in my git repository. Using git rm --a obviously did not work. How can I remove this file?

Lars Noschinski
  • 3,667
  • 16
  • 29
floriansuchan
  • 255
  • 4
  • 13

2 Answers2

7

Try

git rm -- --a

The -- helps separating the command from the parameters

See more on the double hyphen syntax in "Deleting a badly named git branch".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
4

You can use

git rm ./--a 

This can be used to remove any file with the name starts with '-'

nirajkumar
  • 335
  • 1
  • 3
  • 14