gitgitignoregit-untracked

Git : Untrack files without remove git cache


I try to ignore a folder with git update-index --skip-worktree command, but it cant mark to S (skip-worktree) files under the folder until i remove git cache. git rm -r --cached

When i check files with git ls-files -v all of them still mark with H. If i remove git cahce, this time, it removes all files from local which are need to be mark S, and files wait in stage to commit.

I try to gitignore_global but same thing is happen. I need untrack the folder directory without removing cache or push anything to remote. Is it possible ?


Solution

  • It sounds like what you want to do is ignore tracked files, and as the Git FAQ mentions, Git has no way to do that. git update-index is specifically mentioned by the FAQ as not working for that purpose.

    If you have build files, they shouldn't be checked into the repository. Git is not an asset store, and not checking build files into the repository will prevent them from being modified when you rebuild.