Module: Gitcycle::Push

Included in:
Gitcycle
Defined in:
lib/gitcycle/push.rb

Instance Method Summary collapse

Instance Method Details

#push(*args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gitcycle/push.rb', line 4

def push(*args)
  exec_git(:push, args) if args.length > 0

  require_git && require_config

  branch = pull

  if branch && branch['collab']
    puts "\nPushing branch '#{branch['home']}/#{branch['name']}'.\n".green
    run("git push #{branch['home']} #{branch['name']} -q")
  elsif branch
    puts "\nPushing branch 'origin/#{branch['name']}'.\n".green
    run("git push origin #{branch['name']} -q")
  else
    current_branch = branches(:current => true)
    puts "\nPushing branch 'origin/#{current_branch}'.\n".green
    run("git push origin #{current_branch} -q")
  end
end