Class: GitSyncFork::Runner

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/git_sync_fork/runner.rb

Instance Method Summary collapse

Instance Method Details

#sync(upstream = "upstream", branch = "master", origin = "origin") ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/git_sync_fork/runner.rb', line 10

def sync(upstream = "upstream", branch = "master", origin = "origin")
  # sync local and origin
  run "git pull"
  # sync local and upstream
  run "git fetch #{upstream}"
  run "git merge #{upstream}/#{branch}"
  # push to origin
  current_branch = `git symbolic-ref --short HEAD`
  run "git push #{origin} #{current_branch}"
end