7

Is it possible to ignore deleted files in git? git update-index --assume-unchanged allows me to ignore modifications, but it still tracks deletions.

(This is similar, but I couldn't find where "John Doe" restated his question: Ignore modified (but not committed) files in git?)

Community
  • 1
  • 1
matt_h
  • 1,289
  • 14
  • 17
  • It seems odd to me to be tracking files that you don't actually want... but I guess you have your reasons. – Cascabel Apr 12 '10 at 15:49

2 Answers2

2

Rather than trying to ignore the "delete" status, I would:

  • not remove the directory and those files in it
  • split the Git repo in two, effectively detaching the subdirectory to be removed into a separate Git repository.
  • go on with the main Git repo.

Note: that may not be compatible with a Git repo currently synchronized with a SVN one.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
2

The following stops will surely solve your problem:

  1. Ensure that all deleted files are not staged to commit. If they are staged, to unstage them you can simply do git reset

  2. After this step, run the following command

    git ls-files --deleted -z | git update-index --assume-unchanged -z --stdin

Note: The first command. git ls-files --deleted -z, lists all the deleted files as a string. Then it takes that as the input to the second command.

Shivansh Jagga
  • 1,541
  • 1
  • 15
  • 24