Created
March 4, 2015 09:19
-
-
Save lokeshjain2008/ebfa338f7b1e75494541 to your computer and use it in GitHub Desktop.
to create patch folder from git status
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
#get all the files changed by git | |
files_raw = `git status | grep modified` # => "\tmodified: tests/AllTests.php\n\tmodified: tests/RLTestConfig.php\n" | |
files = files_raw | |
.gsub(/\n/,"#") | |
.gsub(/[\t\n]/,"") #remove unwanted elements | |
.split('#').reject{|element| element.length < 2} # get each line for the file | |
.map{|file| file.split(":").last.strip } # git the file name | |
p files # => ["tests/AllTests.php", "tests/RLTestConfig.php"] | |
foldername = 'localNeeded' | |
files.each do |file| | |
`rsync -R #{file} #{foldername}` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment