If you run git update-index --assume-unchanged <file>
before you delete the file then this will work. e.g.
$ git update-index --assume-unchanged <file>
$ rm <file>
$ git status
# On branch master
nothing to commit, working directory clean
Question
I need delete file from file system which is tracked by Git repository and I want leave that file in Git repository unchanged (no commit to repo). It's easy for locally modified file where I'm using assume-unchanged option of update index and it works just fine. I need same behavior for deleted files.
I've tried this with no success:
git update-index --assume-unchanged <file>
.git/info/exclude
Solution
If you run git update-index --assume-unchanged <file>
before you delete the file then this will work. e.g.
$ git update-index --assume-unchanged <file>
$ rm <file>
$ git status
# On branch master
nothing to commit, working directory clean