Frage

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
War es hilfreich?

Lösung

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top