Dmitry Shuran
Dmitry Shuran

Reputation: 83

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

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

Upvotes: 3

Views: 1082

Answers (1)

Evolve
Evolve

Reputation: 9219

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

Upvotes: 2

Related Questions