3

I have just added .rubocop.yml file to my project and added it to .gitignore file but when I do git status it appears as modified. I have never added this file to my repository. Why is .gitignore not ignoring this file?

project

app/ config/ .rubocop.yml

.gitignore

.rubocop.yml

Other files are ignored fine, for example, I also tried adding tags file to the root of the project and adding it to .gitignore and it works.

Why is .gitignore not ignoring .rubocop.yml file?

Community
  • 1
  • 1
jedi
  • 2,003
  • 5
  • 28
  • 66
  • 2
    .gitignore only applies to files that have not been added. If the status shows as "modified" then it has already been added, and .gitignore does not apply to it. – user2864740 Nov 28 '18 at 00:39
  • https://stackoverflow.com/q/19663093/2864740 , https://stackoverflow.com/q/1274057/2864740 – user2864740 Nov 28 '18 at 00:40
  • I now checked again and indeed I added the file previously to the repo. My bad. Thank you. – jedi Nov 28 '18 at 00:45

1 Answers1

11

Commit your project first, then do git rm --cached .rubocop.yml. It shouldn't be included in your repository the next time you commit

akmin04
  • 677
  • 6
  • 14