how to apply git --skip-worktree for entire directory?

Viewed 399

The command git update-index --skip-worktree works great but only for the single files. Is there a way apply it to multiple folders?

1 Answers

I resolved this by making a small ruby script, call it something like 'gitskip.rb'

#!/usr/bin/env ruby

Dir.foreach(Dir.pwd) do |filename|
  next if filename[0] == '.' or filename == '..'
  `git update-index --skip-worktree #{filename}`
  puts "#{filename} skipped."
end

And run it from the directory you're in.

$ ruby gitskip.rb
Related