Method: Git::Lib#add

Defined in:
lib/git/lib.rb

#add(paths = '.', options = {})

updates the repository index using the working directory content

lib.add('path/to/file') lib.add(['path/to/file1','path/to/file2']) lib.add(:all => true)

options: :all => true :force => true

Parameters:

  • paths (String, Array) (defaults to: '.')

    files paths to be added to the repository

  • options (Hash) (defaults to: {})


653
654
655
656
657
658
659
660
661
662
663
664
665
666
# File 'lib/git/lib.rb', line 653

def add(paths='.',options={})
  arr_opts = []

  arr_opts << '--all' if options[:all]
  arr_opts << '--force' if options[:force]

  arr_opts << '--'

  arr_opts << paths

  arr_opts.flatten!

  command('add', *arr_opts)
end