lib/gitup.rb in gitup-0.0.2 vs lib/gitup.rb in gitup-0.0.3

- old
+ new

@@ -4,10 +4,11 @@ if on_master? puts "You are on the master branch. Gitdown is intended to be used in local branches." puts "git checkout -b yournewbranch to create a new local branch" puts "or git checkout yourexistingbranch to checkout an existing one." + system "git pull origin master" exit end unless everything_commited? system "git status" @@ -32,17 +33,26 @@ def self.gitup! unless everything_commited? system "git status" - raise "Hold your horses! You must commit your changes first." + puts "Warning: You have uncommitted changes. Continue? (y/n)" + input = gets.chomp + + if input.downcase == 'y' + # Stash the changes, do the push and then apply our stash + system "git stash" + self.run_gitup_commands(current_branch) + system "git stash apply" + else + puts 'Good girl.' + exit + end + else + # Push it! + self.run_gitup_commands(current_branch) + exit end - - # Push it! - self.run_gitup_commands(current_branch) - - puts "Finished." - exit end def self.on_master? current_branch == 'master' end \ No newline at end of file