Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

file

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

like image 358
Dmitry Shuran Avatar asked Oct 14 '25 07:10

Dmitry Shuran


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
like image 91
Evolve Avatar answered Oct 16 '25 21:10

Evolve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!