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
  • 13,671
  • 27
  • 117
  • 166

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
  • 193,403
  • 52
  • 435
  • 836
Carl Norum
  • 219,201
  • 40
  • 422
  • 469
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
  • 193,403
  • 52
  • 435
  • 836