Method: Git::Lib#push

Defined in:
lib/git/lib.rb

#push(remote = nil, branch = nil, opts = nil)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

  • (ArgumentError)


1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
# File 'lib/git/lib.rb', line 1481

def push(remote = nil, branch = nil, opts = nil)
  remote, branch, opts = normalize_push_args(remote, branch, opts)
  ArgsBuilder.validate!(opts, PUSH_OPTION_MAP)

  raise ArgumentError, 'remote is required if branch is specified' if !remote && branch

  args = build_push_args(remote, branch, opts)

  if opts[:mirror]
    command('push', *args)
  else
    command('push', *args)
    command('push', '--tags', *(args - [branch].compact)) if opts[:tags]
  end
end