Module: Git
- Defined in:
- lib/Git/git.rb
Class Method Summary collapse
- .checkout(branch) ⇒ Object
- .delete_branch(branch) ⇒ Object
- .exist_branch?(branch) ⇒ Boolean
- .fetch(branch) ⇒ Object
- .log_last_changes(branch) ⇒ Object
- .merge(from, to) ⇒ Object
- .new_branch(branch) ⇒ Object
- .pull(branch) ⇒ Object
- .push(branch) ⇒ Object
- .reset_hard(from, to) ⇒ Object
Class Method Details
.checkout(branch) ⇒ Object
2 3 4 5 6 7 |
# File 'lib/Git/git.rb', line 2 def self.checkout branch print "checkout: ".yellow print "#{branch}\n\n".green system "git checkout #{branch}" self.pull branch end |
.delete_branch(branch) ⇒ Object
19 20 21 22 23 |
# File 'lib/Git/git.rb', line 19 def self.delete_branch branch print "Delete branch: ".yellow print "#{branch} \n\n".green system("git checkout develop && git branch -D #{branch}") end |
.exist_branch?(branch) ⇒ Boolean
63 64 65 66 |
# File 'lib/Git/git.rb', line 63 def self.exist_branch? branch execute {"git fetch origin #{branch}"} end |
.fetch(branch) ⇒ Object
50 51 52 53 54 |
# File 'lib/Git/git.rb', line 50 def self.fetch branch print "Fetch: ".yellow print "#{branch}\n\n".green system "git fetch origin #{branch}" end |
.log_last_changes(branch) ⇒ Object
40 41 42 |
# File 'lib/Git/git.rb', line 40 def self.log_last_changes branch execute {"git log origin/#{branch}..HEAD --oneline --format='%ad - %B'"} end |
.merge(from, to) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/Git/git.rb', line 9 def self.merge from, to # self.checkout(from) self.checkout(to) print "Merge ".yellow print "#{from} ".green print "into ".yellow print "#{to} \n\n".green execute {"git pull origin #{from}"} end |
.new_branch(branch) ⇒ Object
56 57 58 59 60 |
# File 'lib/Git/git.rb', line 56 def self.new_branch branch print "Create new branch: ".yellow print "#{branch}\n".green system "git checkout -b #{branch}" end |
.pull(branch) ⇒ Object
44 45 46 47 48 |
# File 'lib/Git/git.rb', line 44 def self.pull branch print "Pull: ".yellow print "#{branch}\n\n".green system "git pull origin #{branch}" end |
.push(branch) ⇒ Object
34 35 36 37 38 |
# File 'lib/Git/git.rb', line 34 def self.push branch print "Push: ".yellow print "#{branch}\n\n".green execute {"git push origin #{branch}"} end |
.reset_hard(from, to) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/Git/git.rb', line 25 def self.reset_hard from, to self.fetch from self.fetch to self.checkout(to) print "Reset --hard: #{to} is equal: ".yellow print "#{from}\n".green system "git reset --hard origin/#{from}\n\n" end |