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,637
  • 15
  • 29
floriansuchan
  • 233
  • 4
  • 11

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,129,465
  • 480
  • 4,036
  • 4,755
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