2 `git branch | grep "*"`.strip[2..-1]
6 m = /git version (\d+).(\d+).(\d+)/.match(`git version`.strip)
7 return true if m[1].to_i > 1
8 return false if m[1].to_i < 1
9 return true if m[2].to_i > 5
10 return false if m[2].to_i < 5
11 return true if m[3].to_i >= 3
16 raise "Invalid git version, use at least 1.5.3" unless compare_git_ver
21 `git diff-files --quiet`
24 clear = `git stash list`.scan("\n").size == 0
25 puts "* Saving changes..."
35 puts "* Switching back to master..."
40 puts "* Pulling in new commits..."
42 sh "git rebase origin"
45 puts "* Porting changes into #{branch}..."
46 `git checkout #{branch}`
47 sh "git rebase master"
51 puts "* Applying changes..."
53 `git stash clear` if clear
60 `git diff-files --quiet`
62 puts "You have outstanding changes. Please commit them first."
66 puts "* Merging topic '#{branch}' back into master..."
68 sh "git merge #{branch}"
74 puts "* Pushing changes..."
78 puts "* Switching back to #{branch}..."
79 `git checkout #{branch}`