Class: GitHelper::NewBranch

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

Instance Method Summary collapse

Instance Method Details

#execute(new_branch_name = nil) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/git_helper/new_branch.rb', line 5

def execute(new_branch_name = nil)
  branch_name = new_branch_name || cli.ask('New branch name?')
  puts "Attempting to create a new branch: #{branch_name}"
  system("git pull")
  system("git branch --no-track #{branch_name}")
  system("git checkout #{branch_name}")
  system("git push --set-upstream origin #{branch_name}")
end