0

I have used this post Removing multiple files from a Git repo that have already been deleted from disk to figure out how to remove multiple files with git rm at once.

Now, I'd like to do this, excluding one directory. I tried this:

git rm $(git ls-files --deleted --exclude='sites/all/modules/imagecache_actions/')

but it didn't work. Am I misusing the exclude tag?

Community
  • 1
  • 1
user1015214
  • 2,733
  • 10
  • 36
  • 66
  • 1
    If the only changes are deletions, just use `git add -u .` to stage all updates/deletions, then use `git reset ` to unstage the one directory you want to leave alone. – user229044 Sep 02 '14 at 20:47
  • Thats the issue, there are modifications too. So, I'd like a clean way of excluding them – user1015214 Sep 03 '14 at 12:37

1 Answers1

0
git ls-files -d | sed '/^sites\/all\/modules\/imagecache_actions\//d' | xargs git rm

The -x --exclude option only works with untracked files.

giorni
  • 157
  • 1
  • 8