Sha256: 1d34441fd19341355492ad1201bdb5ed1c54abd26bbfc05ac7f90138881a2501

Contents?: true

Size: 515 Bytes

Versions: 5

Compression:

Stored size: 515 Bytes

Contents

require_relative './highline_cli.rb'

module GitHelper
  class NewBranch
    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

    private def cli
      @cli ||= GitHelper::HighlineCli.new
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
git_helper-1.2.0 lib/git_helper/new_branch.rb
git_helper-1.1.1 lib/git_helper/new_branch.rb
git_helper-1.1.0 lib/git_helper/new_branch.rb
git_helper-1.0.1 lib/git_helper/new_branch.rb
git_helper-1.0.0 lib/git_helper/new_branch.rb