1

My .gitignore file is the following:

$ cat .gitignore
Index/
Index/LOG

I added .gitignore file to repo, commit and even push. But git status permanently shows:

# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   Index/LOG
#

So how to exclude whole Index folder from git repository forever?

Maxim Yefremov
  • 12,753
  • 25
  • 112
  • 158

2 Answers2

9

Git doesn't ignore tracked files. You need to delete that file from the repository before it will be ignored:

$ git rm -r Index
$ git commit -m "Deleting 'Index' folder."

This will remove the files. If you only want to remove them from the index use --cached:

$ git rm -r --cached Index

This will keep all files in the file-system and only removes them from git.

hakre
  • 184,866
  • 48
  • 414
  • 792
Carl Norum
  • 210,715
  • 34
  • 410
  • 462
0

To exclude the the Index folder, remove it and commit the changes. This is outlined in:

That simple it is. If you only want to update the index telling git that nothing changed even it changed, use the update-index commmand:

Community
  • 1
  • 1
hakre
  • 184,866
  • 48
  • 414
  • 792