Sha256: 56a5ece4b5448f568ec6ed959d847e85ac1e3d680c122ead84e1a1ca64aec48e
Contents?: true
Size: 826 Bytes
Versions: 3
Compression:
Stored size: 826 Bytes
Contents
require 'straight_line/common/command' module GitCommands # Push a branch to remote class Push < Command def initialize(branch, remote_exists = true, opts = {}) super('git') arg 'checkout' arg branch if remote_exists.is_a? Hash opts = remote_exists remote_exists = true end sub_command push_command(branch, remote_exists, opts) end def push_command(branch, remote_exists, opts) push_command = Command.new('git') .arg('push') if opts[:delete] push_command .arg('origin') .arg('--delete') .arg(branch) elsif !remote_exists push_command .arg('--set-upstream') .arg('origin') .arg(branch) end push_command end end end
Version data entries
3 entries across 3 versions & 1 rubygems