3

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
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
michal.kreuzman
  • 12,170
  • 10
  • 58
  • 70

1 Answers1

3

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
mikej
  • 65,295
  • 17
  • 152
  • 131
  • Thanks it works! I've tried this also but TortoiseGit seems to ignore it and still showing deleted files in commit dialog. So it's not Git problem and this practice works fine. – michal.kreuzman Feb 20 '14 at 12:58