Created
August 17, 2011 23:24
-
-
Save kimhunter/1152903 to your computer and use it in GitHub Desktop.
Export Git stashes
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
require "yaml" | |
stash_list = `git stash list`.chomp.split("\n").map {|i| i.chomp } | |
stash_list.map!{|s| | |
b = s.match(/stash@\{([0-9]+)\}: (.*)/) | |
[b[1], b[2]] | |
} | |
stash_list.each do |s| | |
puts "{#{s[0]}}" | |
`git diff stash@{#{s[0]}} > stashes/#{s[0]}.diff` | |
end | |
puts stash_list.to_yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment