0

I have a folder, ex: folder1, that is being tracked by git for a long time. If I inset a new file, ex: file1 inside it, git status show a change, as should be.

But now I do not want that folder1 to be tracked by any more.

So, I set in .gitignore folder1/, and add and commit .gitignore.

After this, if I add new files, says file2, git status do not show me the new file that was added (file2) after gitignore was set, but still showing chages that was made before the gitignore settings.

modified:   folder1/file1.txt (in red)

I already tried unstage the file1.txt and I followed this post Ignoring an already checked-in directory's contents? and this one Untrack and stop tracking files in git but not worked. I was expecting to have the message:

$ git status
On branch master
nothing to commit, working directory clean

What am I missing?

Community
  • 1
  • 1
IgorAlves
  • 5,086
  • 10
  • 52
  • 83

2 Answers2

0

I'm pretty sure you actually need to delete (git rm) that file if you don't want it to be there any more.

John Leidegren
  • 59,920
  • 20
  • 131
  • 152
  • 2
    `git rm --cached ` would be more prudent. – jub0bs May 27 '15 at 20:43
  • Hi John, I can not delete the file or the folder because it still in use by the system. In fact the programmer before me do not ignored the whole folde and now I need to ignore it. – IgorAlves May 27 '15 at 21:00
  • @zwitterion given the circumstances I don't think what you want is doable, you can try different .gitignore patterns but ultimately if the presence of that files is the issue and you cannot delete it, you cannot do what you want. – John Leidegren May 28 '15 at 14:06
0

I found the solution

$ git update-index --assume-unchanged "path/file-name"

Ignore files that have already been committed to a Git repository

Community
  • 1
  • 1
IgorAlves
  • 5,086
  • 10
  • 52
  • 83