Module: Git
- Defined in:
- lib/jekyll_theme_marketing/git.rb
Overview
Git module to performe git operations
Class Method Summary collapse
- .add(files = '.') ⇒ Object
- .checkout_new_branch(name) ⇒ Object
- .list_commits(old, new, options = '') ⇒ Object
- .push(remote = '', branch = '', options = '') ⇒ Object
Class Method Details
.add(files = '.') ⇒ Object
7 8 9 |
# File 'lib/jekyll_theme_marketing/git.rb', line 7 def add(files = '.') system "git add #{files}" end |
.checkout_new_branch(name) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/jekyll_theme_marketing/git.rb', line 11 def checkout_new_branch(name) system 'git checkout master' system 'git pull origin master' system "git checkout #{name}" # if the branch doesn't exist, create it system "git checkout -b #{name}" # if the branch does exist, switch to it end |
.list_commits(old, new, options = '') ⇒ Object
18 19 20 |
# File 'lib/jekyll_theme_marketing/git.rb', line 18 def list_commits(old, new, = '') `git log #{} #{old}..#{new}` end |
.push(remote = '', branch = '', options = '') ⇒ Object
22 23 24 |
# File 'lib/jekyll_theme_marketing/git.rb', line 22 def push(remote = '', branch = '', = '') system "git push #{} #{remote} #{branch}" end |