Module: Git

Defined in:
lib/jekyll_theme_marketing/git.rb

Overview

Git module to performe git operations

Class Method Summary collapse

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, options = '')
  `git log #{options} #{old}..#{new}`
end

.push(remote = '', branch = '', options = '') ⇒ Object



22
23
24
# File 'lib/jekyll_theme_marketing/git.rb', line 22

def push(remote = '', branch = '', options = '')
  system "git push #{options} #{remote} #{branch}"
end