24

I want git to ignore my csv files. But, when I do git status, I see that the csv is in "Changes not staged for commit". But, I swear I added it to the .gitignore file a while ago. In fact, when I look at the .gitignore file, I see that it is there!

*.csv

So, how to I get git to ignore my csv's? The problem is that I want to be able to do git reset and git checkout without having to worry about the csv files being overwritten in my working directory.

makansij
  • 9,303
  • 37
  • 105
  • 183
  • 3
    Are the csv files already checked into the git repo or is this the initial check in? – Dale Oct 16 '15 at 16:59

2 Answers2

30

Looks like the problem is that, the csv files are already tracked in a commit before, so even though you add *.csv the git will start tracking the previously tracked files.

You can solve this using git rm --cached option, discussed in detail in this stackoverflow question

Community
  • 1
  • 1
Sharath Bhaskara
  • 467
  • 6
  • 12
13

It should add *.csv in your .gitignore file and after that use git rm --cached *.csv to remove all existing csv files from your git repository

KIT
  • 155
  • 1
  • 6