I am initializing a git repository that already has some files in it
repo = Rugged::Repository.init_at(".")
I need to stage the files already in that folder and commit them. This is what I've tried:
repo = Rugged::Repository.new(".")
index = repo.index
index.add_all()
options = {}
options[:tree] = index.write_tree(repo)
options[:author] = { :email => "testuser@github.com", :name => 'Test Author', :time => Time.now }
options[:committer] = { :email => "testuser@github.com", :name => 'Test Author', :time => Time.now }
options[:message] ||= "Making a commit via Rugged!"
options[:parents] = repo.empty? ? [] : [ repo.head.target ].compact
options[:update_ref] = 'HEAD'
Rugged::Commit.create(repo, options)
However if I look into the directory and run a git status
all I get is:
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: .editorconfig
deleted: .gitignore
deleted: Procfile
deleted: README.md
Untracked files:
(use "git add <file>..." to include in what will be committed)
.editorconfig
.gitignore
Procfile
README.md