2

We have set up our .gitignore file to ignore

  • all files ending in *.sdf
  • as well as the full path to the file, e.g. /MyProject/Database/MyDatabase.sdf with / being the project's root (top-level directory checked into git) to specifically ignore that one file

but the file keeps coming back as it is checked in by various members of the team.

Any ideas how to really exclude the .sdf file for good?

We can't quite grasp why it keeps popping up in the modified files for everybody..

cacau
  • 3,606
  • 3
  • 21
  • 42

1 Answers1

5

If it pop in the modified files it probably means you have already committed the file by the past. Before adding the .gitignore rule.

Am I right?

You will have to remove it via git rm and commit the change.

Aurélien Thieriot
  • 5,853
  • 2
  • 24
  • 25
  • 1
    We keep deleting the file (via git) - and still it keeps popping up as modified – cacau Feb 06 '14 at 12:21
  • modified or untracked? – Aurélien Thieriot Feb 06 '14 at 12:22
  • we're not entirely sure - somebody in the team keeps committing it accidentally, when we notice it's back again it's hard to track. But we're 90% sure it keeps showing up as modified - otherwise you wouldn't commit it w/o consciously adding it to source control, right? – cacau Feb 06 '14 at 12:27
  • Yeah. It's a tricky one. Once the file is tracked by Git, you have to make it forget it has ever existed. At some point you will have to make all your developers up to date with that. – Aurélien Thieriot Feb 06 '14 at 12:30
  • If you can't manage to have everyone up to date with the "delete" part (either you work on branches or whatever) you might want to actually remove the file from the history, for real (Like killing hitler). Please look at this post as it explains the right usage of git filter-branch: http://stackoverflow.com/questions/5563564/completely-remove-files-from-git-repo-and-remote-on-github – Aurélien Thieriot Feb 06 '14 at 12:32
  • But keep in mind that is a drastic process and you will have to push --force the history and it won't be pretty when other devs would want to sync their own work. I strongly suggest you to talk to the other devs to make sure the file is delete – Aurélien Thieriot Feb 06 '14 at 12:33
  • 2
    Often `git rm --cached` is better than simply `git rm`, as it will leave the file in your working directory but delete it from Git. – ChrisGPT was on strike Feb 06 '14 at 13:17