Skip to content

Instantly share code, notes, and snippets.

@milligramme
Created May 25, 2016 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milligramme/429be5ae23d586027a483c1fb1dd1ef6 to your computer and use it in GitHub Desktop.
Save milligramme/429be5ae23d586027a483c1fb1dd1ef6 to your computer and use it in GitHub Desktop.
require 'date'
require 'fileutils'
include FileUtils
data = DATA.read
root, *paths = data.split("\n")
puts root
today_dir = File.expand_path("~/Desktop/#{Date.today.to_s}/#{File.basename(root)}")
mkdir_p today_dir unless File.exist? today_dir
# paths =
paths.each { |e| mkdir_p "#{today_dir}/#{File.dirname(e)}" unless File.dirname(e) == "." }
paths.each { |e| cp_r "#{File.expand_path root}/#{e}", "#{today_dir}/#{e}" }
# 1行目に基準パス
# それ以降に git diff --name-only したリスト
__END__
/path/to/repo
lib/something/anything.rb
lib/something/version.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment