, , . . pull, fetch, . ,
repo.fetch('origin', [repo.head.name], credentials: credits)
, , - , , . . , , git , . , . , , , , .
, , ( ),
ref_name = repo.head.name
branch_name = ref_name.sub(/^refs\/heads\//, '')
remote_name = "#{remote}/#{branch_name}"
remote_ref = "refs/heads/#{remote_name}"
local_branch = repository.branches[branch_name]
remote_branch = repository.branches[remote_name]
index = repo.merge_commits(local_branch.target, remote_branch.target)
options = {
author: { time: Time.now }.merge(author),
committer: { time: Time.now }.merge(committer),
message: 'merged',
parents: [
local_branch.target,
remote_branch.target
],
tree: index.write_tree(repository),
update_ref: 'HEAD'
}
Rugged::Commit.create repo, options
, . . - . . , .
- , , ? - 0.22.0b3
1
repo.checkout ref_name, strategy: :force
Update2
,
r = repo.remotes[remote]
r.fetch(credentials: git_credentials)
r.save