Sha256: d9ca41bf56e9d693b101d6e4695589f2115e5e94df4ef67f8fb2baa1e78b00a3

Contents?: true

Size: 871 Bytes

Versions: 7

Compression:

Stored size: 871 Bytes

Contents

#!/usr/bin/env ruby

#start a new git branch with latest changes from master

require File.join(File.dirname(__FILE__), '..', 'lib', 'socialcast-git-extensions.rb')
include Socialcast::Gitx
include Socialcast::Git

unless branch_name = ARGV.first
  example_branch = %w{ api-fix-invalid-auth desktop-cleanup-avatar-markup share-form-add-edit-link }.sort_by { rand }.first
  repo = Grit::Repo.new(Dir.pwd)
  remote_branches = repo.remotes.collect {|b| b.name.split('/').last }
  until branch_name = HighLine.ask("What would you like to name your branch? (ex: #{example_branch})") {|q| 
      q.validate = Proc.new { |branch|
        branch =~ /^[A-Za-z0-9\-_]+$/ && !remote_branches.include?(branch)
      }
    }
  end
end

run_cmd 'git checkout master'
run_cmd 'git pull'
run_cmd "git checkout -b #{branch_name}"

share "#worklog starting work on #{branch_name} #scgitx"

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
socialcast-git-extensions-2.2.8 bin/git-start
socialcast-git-extensions-2.2.7 bin/git-start
socialcast-git-extensions-2.2.6 bin/git-start
socialcast-git-extensions-2.2.5 bin/git-start
socialcast-git-extensions-2.2.4 bin/git-start
socialcast-git-extensions-2.2.3 bin/git-start
socialcast-git-extensions-2.2.2 bin/git-start