Class: Kuy

Inherits:
Object
  • Object
show all
Defined in:
lib/kuy.rb

Class Method Summary collapse

Class Method Details

.pull_and_merge_from(branch) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/kuy.rb', line 2

def self.pull_and_merge_from(branch)
  return 'git is not installed' if system('git --version').nil?

  current_branch = `git rev-parse --abbrev-ref HEAD`.strip

  puts "Running checkout and update from origin/#{branch}"
  `git checkout #{branch}`
  `git pull origin #{branch}`

  puts "Merging with origin/#{current_branch}"
  `git checkout #{current_branch}`
  `git merge #{branch} --no-ff`
  puts 'Done!'
end