Class: GT::Commands::Sync
- Inherits:
-
Object
- Object
- GT::Commands::Sync
- Defined in:
- lib/gt/commands/sync.rb
Class Method Summary collapse
Class Method Details
.run(_argv) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gt/commands/sync.rb', line 6 def self.run(_argv) origin = GT::Git.main_branch current = GT::Git.current_branch unless GT::Git.all_branches.include?(origin) raise GT::UserError, "Main branch '#{origin}' not found. Configure with: git config gt.main-branch <branch>" end GT::UI.spinner("Pulling #{origin}") do GT::Git.checkout(origin) GT::Git.pull GT::Git.checkout(current) unless current == origin end GT::Commands::Restack.run([]) end |