lib/dev_flow/girc.rb in dev_flow-0.1.0 vs lib/dev_flow/girc.rb in dev_flow-0.1.1

- old
+ new

@@ -113,11 +113,11 @@ `#{@git} push #{remote} :#{branch}` if remote end def stash! unless wd_clean? - info "Save you change to stash" + info "Stash your local changes" `#{@git} add .` `#{@git} stash` end end @@ -129,35 +129,38 @@ # remote from a specified remote ref def rebase! remote = 'origin', branch = 'develop' cb = self.current_branch stashed = false + unless self.wd_clean? - info "Stash your local changes" self.stash! stashed = true end if branch == self.current_branch info "Pull from remote" # `#{@git} pull --rebase #{remote} #{branch}` `#{@git} pull #{remote} #{branch}` else - info "pull branch #{self.current_branch} from remote" - `#{@git} pull #{remote} #{self.current_branch}` info "Switch to branch #{branch}" `#{@git} fetch #{remote}` rslt = `#{@git} checkout #{branch}` raise "Checkout failed: #{rslt}" unless $?.success? + info "Update branch from remote" # rslt = `#{@git} pull --rebase #{remote} #{branch}` rslt = `#{@git} pull #{remote} #{branch}` raise "Pull for #{branch} failed: #{rslt}" unless $?.success? + info "Switch back to branch #{cb}" `#{@git} checkout #{cb}` info "Merge from #{branch}" rslt = `#{@git} merge #{branch}` raise "Merge with #{branch} failed: #{rslt}" unless $?.success? + + info "pull branch #{self.current_branch} from remote" + `#{@git} pull #{remote} #{self.current_branch}` end self.stash_pop! if stashed end