Last active
August 29, 2015 14:07
-
-
Save ktaragorn/1b5468843e587e818383 to your computer and use it in GitHub Desktop.
Rewrite history to move files from the root of the project into sub dir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files = Dir.entries(".") | |
sub_dir = "clowns_as_many" | |
(files - [".", "..", ".git", ".gitignore", "lib", ".DS_Store", "move.rb"]).each do |file| | |
cmd = "git filter-branch -f --tree-filter \'if [ -e #{file} ]; then mkdir -p #{sub_dir} && mv #{file} #{sub_dir}/; fi\' HEAD" | |
p cmd | |
system cmd | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is to move all files except those in the blacklist from the root dir to the dir
clowns_as_many