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:

  1. git update-index --assume-unchanged <file>
  2. Add file to .git/info/exclude
Was it helpful?

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top